tur/hash
canonical integer hashing across numeric widths.
Since: Phase C
hash-int
(hash-int [n :int] :int)
hash a 64-bit signed integer via splitmix64 finalizer.
| n | value to hash |
A 64-bit hash of n as :int.
(hash-int 42) ; => some stable 64-bit integer
Since: Phase C
hash-int8
(hash-int8 [n :int8] :int)
hash an int8; equals (hash-int (as int n)) via sign-extension.
| n | int8 value to hash |
Same as (hash-int (as int n)).
(= (hash-int8 42i8) (hash-int 42)) ; => true
Since: Phase C
hash-int16
(hash-int16 [n :int16] :int)
hash an int16; equals (hash-int (as int n)) via sign-extension.
| n | int16 value to hash |
Same as (hash-int (as int n)).
(= (hash-int16 1000i16) (hash-int 1000)) ; => true
Since: Phase C
hash-int32
(hash-int32 [n :int32] :int)
hash an int32; equals (hash-int (as int n)) via sign-extension.
| n | int32 value to hash |
Same as (hash-int (as int n)).
(= (hash-int32 100000i32) (hash-int 100000)) ; => true
Since: Phase C
hash-int64
(hash-int64 [n :int64] :int)
hash an int64; identical to hash-int.
| n | int64 value to hash |
Same as (hash-int (as int n)).
(= (hash-int64 42i64) (hash-int 42)) ; => true
Since: Phase C
hash-uint8
(hash-uint8 [n :uint8] :int)
hash a uint8 via zero-extension to :int.
| n | uint8 value to hash |
Same as (hash-int (as int n)) where (as int n) zero-extends.
(not= (hash-uint8 255u8) (hash-int -1)) ; => true
Since: Phase C
hash-uint16
(hash-uint16 [n :uint16] :int)
hash a uint16 via zero-extension to :int.
| n | uint16 value to hash |
Same as (hash-int (as int n)) where (as int n) zero-extends.
(= (hash-uint16 1000u16) (hash-int 1000)) ; => true
Since: Phase C
hash-uint32
(hash-uint32 [n :uint32] :int)
hash a uint32 via zero-extension to :int.
| n | uint32 value to hash |
Same as (hash-int (as int n)) where (as int n) zero-extends.
(= (hash-uint32 1000u32) (hash-int 1000)) ; => true
Since: Phase C
hash-uint64
(hash-uint64 [n :uint64] :int)
hash a uint64 by reinterpreting as :int then hashing.
| n | uint64 value to hash |
Hash of the 64-bit bit pattern of n.
(hash-uint64 0u64) ; => same as (hash-int 0)
Since: Phase C