Maps the 32 bit integer key
to an unsigned integer value with only nbits
bits where nbits
is less than 32
(Specification)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int32), | intent(in) | :: | key | |||
integer, | intent(in) | :: | nbits |
elemental function fibonacci_hash( key, nbits ) result( sample ) !! Version: experimental !! !! Maps the 32 bit integer `key` to an unsigned integer value with only `nbits` !! bits where `nbits` is less than 32 !! ([Specification](../page/specs/stdlib_hash_procedures.html#fibonacci_hash-maps-an-integer-to-a-smaller-number-of-bits)) integer(int32), intent(in) :: key integer, intent(in) :: nbits integer(int32) :: sample sample = ishft( key*pow32_over_phi, -32 + nbits ) end function fibonacci_hash