Module: JumpHash

Defined in:
lib/jumphash.rb,
lib/jumphash/version.rb,
ext/jumphash/jumphash.c

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.hash_key(key, buckets) ⇒ Object



21
22
23
24
25
# File 'ext/jumphash/jumphash.c', line 21

static VALUE
hash_key(VALUE klass, VALUE key, VALUE buckets)
{
  return INT2NUM(jump_hash(NUM2ULL(key), NUM2UINT(buckets)));
}

.hash_string(str, buckets) ⇒ Object



5
6
7
# File 'lib/jumphash.rb', line 5

def self.hash_string(str, buckets)
  JumpHash.hash_key(yield(str), buckets)
end