summary refs log tree commit diff stats
path: root/lib/pure/hashes.nim
diff options
context:
space:
mode:
authorFabian Keller <bluenote10@users.noreply.github.com>2017-02-26 00:17:21 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-02-26 00:17:21 +0100
commit5774145f5d6b15b831d90e0daa10806d988da799 (patch)
tree84213adc7542579919075aa400c88714edb9d75f /lib/pure/hashes.nim
parentf250c30b9d5beb587d3b62b99dc938447209836d (diff)
downloadNim-5774145f5d6b15b831d90e0daa10806d988da799.tar.gz
added hash for uints (#5435)
Diffstat (limited to 'lib/pure/hashes.nim')
-rw-r--r--lib/pure/hashes.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim
index 17d1c6442..d5759e507 100644
--- a/lib/pure/hashes.nim
+++ b/lib/pure/hashes.nim
@@ -112,6 +112,14 @@ proc hash*(x: int64): Hash {.inline.} =
   ## efficient hashing of int64 integers
   result = toU32(x)
 
+proc hash*(x: uint): Hash {.inline.} =
+  ## efficient hashing of unsigned integers
+  result = cast[int](x)
+
+proc hash*(x: uint64): Hash {.inline.} =
+  ## efficient hashing of uint64 integers
+  result = toU32(cast[int](x))
+
 proc hash*(x: char): Hash {.inline.} =
   ## efficient hashing of characters
   result = ord(x)