struct SubHash
- SubHash
- Struct
- Value
- Object
Defined in:
sub_hash.crsub_hash/version.cr
Constant Summary
-
DefaultBase =
257_u64
-
DefaultModulo =
(1_u64 << HASH_BITS) - 1
-
HASH_BITS =
61
-
find a prime number in http://primes.utm.edu/lists/2small/0bit.html 注意避免溢出
-
VERSION =
"0.1.0"
Constructors
Class Method Summary
- .convert(elem : Char) : UInt64
- .convert(elem : Int) : UInt64
-
.hash(term, base : UInt64 = DefaultBase, modulo : UInt64 = DefaultModulo) : UInt64
x[0] + base * x[1] + base^2 * x[2] ....
Instance Method Summary
Constructor Detail
def self.new(base : UInt64 = DefaultBase, modulo : UInt64 = DefaultModulo, capacity : Int32 = 256)
#
Class Method Detail
x[0] + base * x[1] + base^2 * x[2] ....