parent
73eff1f457
commit
242d39d27f
1 changed files with 3 additions and 3 deletions
|
|
@ -174,16 +174,16 @@ proc hash*[T: proc](x: T): Hash {.inline.} =
|
||||||
else:
|
else:
|
||||||
result = hash(pointer(x))
|
result = hash(pointer(x))
|
||||||
|
|
||||||
proc hashIdentity*[T: Ordinal](x: T): Hash {.inline, since: (1, 3).} =
|
proc hashIdentity*[T: Ordinal|enum](x: T): Hash {.inline, since: (1, 3).} =
|
||||||
## The identity hash. I.e. ``hashIdentity(x) = x``.
|
## The identity hash. I.e. ``hashIdentity(x) = x``.
|
||||||
cast[Hash](ord(x))
|
cast[Hash](ord(x))
|
||||||
|
|
||||||
when defined(nimIntHash1):
|
when defined(nimIntHash1):
|
||||||
proc hash*[T: Ordinal](x: T): Hash {.inline.} =
|
proc hash*[T: Ordinal|enum](x: T): Hash {.inline.} =
|
||||||
## Efficient hashing of integers.
|
## Efficient hashing of integers.
|
||||||
cast[Hash](ord(x))
|
cast[Hash](ord(x))
|
||||||
else:
|
else:
|
||||||
proc hash*[T: Ordinal](x: T): Hash {.inline.} =
|
proc hash*[T: Ordinal|enum](x: T): Hash {.inline.} =
|
||||||
## Efficient hashing of integers.
|
## Efficient hashing of integers.
|
||||||
hashWangYi1(uint64(ord(x)))
|
hashWangYi1(uint64(ord(x)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue