summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure')
-rwxr-xr-xlib/pure/colors.nim19
-rwxr-xr-xlib/pure/pegs.nim1
2 files changed, 7 insertions, 13 deletions
diff --git a/lib/pure/colors.nim b/lib/pure/colors.nim
index 00edaad9c..9f824e5de 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 6702d8beb..44526790f 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"