summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2018-02-10 14:20:31 +0100
committerAraq <rumpf_a@web.de>2018-02-10 14:20:31 +0100
commit45437eb113c10c6a1d57374b112e720377a38dc3 (patch)
tree16ec4bedea780eae84fb7d6b3151bc62ae42f897 /lib/system.nim
parent5c5e54d3a9b80c4d472a44e3b79b11d74cf3d1a8 (diff)
downloadNim-45437eb113c10c6a1d57374b112e720377a38dc3.tar.gz
fixes #4220
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim
index a0330be76..6815932e2 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2005,7 +2005,13 @@ iterator countdown*[T](a, b: T, step = 1): T {.inline.} =
   ## step count. `T` may be any ordinal type, `step` may only
   ## be positive. **Note**: This fails to count to ``low(int)`` if T = int for
   ## efficiency reasons.
-  when T is IntLikeForCount:
+  when T is (uint|uint64):
+    var res = a
+    while res >= b:
+      yield res
+      if res == b: break
+      dec(res, step)
+  elif T is IntLikeForCount:
     var res = int(a)
     while res >= int(b):
       yield T(res)