struct

SubHash

Inherits Struct < Value < Object

Constants

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

new(base : UInt64 = DefaultBase, modulo : UInt64 = DefaultModulo, capacity : Int32 = 256)
Source

Class methods

convert(elem : Char) : UInt64
Source
convert(elem : Int) : UInt64
Source
hash(term, base : UInt64 = DefaultBase, modulo : UInt64 = DefaultModulo) : UInt64

x[0] + base * x[1] + base^2 * x[2] ....

Source

Instance methods

[](start, len) : UInt64
Source
sub_hash(term) : Void
Source