diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-04-15 23:35:10 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-04-15 23:35:10 +0200 |
commit | 60ec5c89c5b54a6f2a249c9c7e525085133da646 (patch) | |
tree | dabd542f822991b6fbdcf503e211aa80f2b849f2 /lib | |
parent | a0b33f9408cd732bffd3779167842bff568eab85 (diff) | |
download | Nim-60ec5c89c5b54a6f2a249c9c7e525085133da646.tar.gz |
added a .since annotation to hashIdentity
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/hashes.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/pure/hashes.nim b/lib/pure/hashes.nim index d6a7c7e41..287b152d2 100644 --- a/lib/pure/hashes.nim +++ b/lib/pure/hashes.nim @@ -44,6 +44,8 @@ ## * `std/sha1 module <sha1.html>`_ for a sha1 encoder and decoder ## * `tables module <tables.html>`_ for hash tables +include "system/inclrtl" + type Hash* = int ## A hash value. Hash tables using these values should ## always have a size of a power of two and can use the ``and`` @@ -172,14 +174,14 @@ proc hash*[T: proc](x: T): Hash {.inline.} = else: result = hash(pointer(x)) -proc hashIdentity*[T: Ordinal](x: T): Hash {.inline.} = +proc hashIdentity*[T: Ordinal](x: T): Hash {.inline, since: (1, 3).} = ## The identity hash. I.e. ``hashIdentity(x) = x``. cast[Hash](ord(x)) when defined(nimIntHash1): proc hash*[T: Ordinal](x: T): Hash {.inline.} = ## Efficient hashing of integers. - hashIdentity(x) + cast[Hash](ord(x)) else: proc hash*[T: Ordinal](x: T): Hash {.inline.} = ## Efficient hashing of integers. |