From 1ba31f8df73573e61154b37b51e11d357a8ff7fa Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sun, 15 Apr 2012 02:54:12 +0300 Subject: [PATCH] minor changes to make the test suite green again --- lib/pure/colors.nim | 19 +++++++------------ lib/pure/pegs.nim | 1 - tests/run/tpegs.nim | 1 - 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/pure/colors.nim b/lib/pure/colors.nim index 00edaad9c7..9f824e5de2 100755 --- a/lib/pure/colors.nim +++ b/lib/pure/colors.nim @@ -29,19 +29,14 @@ template colorOp(op: expr) {.immediate.} = extract(a, ar, ag, ab) extract(b, br, bg, bb) result = rawRGB(op(ar, br), op(ag, bg), op(ab, bb)) - -template satPlus(a, b: expr): expr = - # saturated plus: - block: - var result = a +% b - if result > 255: result = 255 - result -template satMinus(a, b: expr): expr = - block: - var result = a -% b - if result < 0: result = 0 - result +proc satPlus(a, b: int): int {.inline.} = + result = a +% b + if result > 255: result = 255 + +proc satMinus(a, b: int): int {.inline.} = + result = a -% b + if result < 0: result = 0 proc `+`*(a, b: TColor): TColor = ## adds two colors: This uses saturated artithmetic, so that each color diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim index b5c72491c6..f4f347b46e 100755 --- a/lib/pure/pegs.nim +++ b/lib/pure/pegs.nim @@ -1738,7 +1738,6 @@ when isMainModule: else: assert false - var matches: array[0..5, string] if match("abcdefg", peg"c {d} ef {g}", matches, 2): assert matches[0] == "d" assert matches[1] == "g" diff --git a/tests/run/tpegs.nim b/tests/run/tpegs.nim index 8fe3020735..0834d38a7c 100755 --- a/tests/run/tpegs.nim +++ b/tests/run/tpegs.nim @@ -1734,7 +1734,6 @@ when isMainModule: else: doAssert false - var matches: array[0..5, string] if match("abcdefg", peg"c {d} ef {g}", matches, 2): doAssert matches[0] == "d" doAssert matches[1] == "g"