From 22b4e4c2f28419662f833799598474570bbc1b84 Mon Sep 17 00:00:00 2001 From: def Date: Mon, 6 Apr 2015 01:51:28 +0200 Subject: Use more Natural and Positive numbers in proc parameters - Didn't go through all modules, only the main ones I thought of - Building the compiler and tests still work --- lib/pure/algorithm.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/pure/algorithm.nim') diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index a1ab7be13..68960e2e8 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -24,7 +24,7 @@ proc `*`*(x: int, order: SortOrder): int {.inline.} = var y = order.ord - 1 result = (x xor y) - y -proc reverse*[T](a: var openArray[T], first, last: int) = +proc reverse*[T](a: var openArray[T], first, last: Natural) = ## reverses the array ``a[first..last]``. var x = first var y = last @@ -37,7 +37,7 @@ proc reverse*[T](a: var openArray[T]) = ## reverses the array `a`. reverse(a, 0, a.high) -proc reversed*[T](a: openArray[T], first, last: int): seq[T] = +proc reversed*[T](a: openArray[T], first, last: Natural): seq[T] = ## returns the reverse of the array `a[first..last]`. result = newSeq[T](last - first + 1) var x = first -- cgit 1.4.1-2-gfad0 From caef835fe4c769f4d8d2a7728c898e010c431840 Mon Sep 17 00:00:00 2001 From: Araq Date: Fri, 17 Apr 2015 21:21:02 +0200 Subject: fixes #2568 --- lib/pure/algorithm.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/pure/algorithm.nim') diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index 68960e2e8..f7ccb9234 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -40,8 +40,8 @@ proc reverse*[T](a: var openArray[T]) = proc reversed*[T](a: openArray[T], first, last: Natural): seq[T] = ## returns the reverse of the array `a[first..last]`. result = newSeq[T](last - first + 1) - var x = first - var y = last + var x = first.int + var y = last.int while x <= last: result[x] = a[y] dec(y) -- cgit 1.4.1-2-gfad0