mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 20:04:18 +00:00
minor changes to make the test suite green again
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user