Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- (unknown)
Instance Method Summary collapse
Instance Method Details
#consistent_hash ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'ext/consistent_hash/consistent_hash.c', line 3 VALUE consistent_hash(VALUE string) { uint32_t h = 0; for (int i = 0; i < RSTRING_LEN(string); i++) { uint32_t c = RSTRING_PTR(string)[i]; h = h * 31 + c; } return INT2NUM(h); } |