diff options
author | def <dennis@felsin9.de> | 2014-07-09 18:54:05 +0200 |
---|---|---|
committer | def <dennis@felsin9.de> | 2014-07-09 18:54:05 +0200 |
commit | 8b796763a37a41be107b1f4aae50b28a56a3cdb9 (patch) | |
tree | cd05c0fd92e30f7425632924cff861719aeec8d0 /lib/pure/algorithm.nim | |
parent | c591db16c854780cae2f97ec096fed9835a8511b (diff) | |
download | Nim-8b796763a37a41be107b1f4aae50b28a56a3cdb9.tar.gz |
Fix to included last element in reversed
Diffstat (limited to 'lib/pure/algorithm.nim')
-rw-r--r-- | lib/pure/algorithm.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim index 7af1b2ad8..89c83a8a4 100644 --- a/lib/pure/algorithm.nim +++ b/lib/pure/algorithm.nim @@ -36,10 +36,10 @@ proc reverse*[T](a: var openArray[T]) = proc reversed*[T](a: openArray[T], first, last: int): seq[T] = ## returns the reverse of the array `a[first..last]`. - result = newSeq[T](last - first) + result = newSeq[T](last - first + 1) var x = first var y = last - while x < last: + while x <= last: result[x] = a[y] dec(y) inc(x) |