Module: MurmurRedux::Native128
- Defined in:
- ext/murmur_native/murmur_native.c
Instance Method Summary collapse
- #murmur3_128_fmix(integer) ⇒ Object
- #murmur3_128_int32_hash(*args) ⇒ Object
- #murmur3_128_int64_hash(*args) ⇒ Object
- #murmur3_128_str_hash(*args) ⇒ Object
Instance Method Details
#murmur3_128_fmix(integer) ⇒ Object
288 289 290 291 292 293 294 295 296 297 298 |
# File 'ext/murmur_native/murmur_native.c', line 288 static VALUE rb_fmix64(VALUE self, VALUE integer) { #if SIZEOF_LONG == 8 uint64_t _int = NUM2ULONG(integer); return ULONG2NUM(fmix64(_int)); #else uint64_t _int = NUM2ULL(integer); return ULL2NUM(fmix64(_int)); #endif } |
#murmur3_128_int32_hash(*args) ⇒ Object
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'ext/murmur_native/murmur_native.c', line 396 static VALUE rb_murmur3_128_int32_hash(int argc, VALUE* argv, VALUE self) { VALUE ar_result; uint32_t result[4], _int; if (argc == 0 || argc > 2) { rb_raise(rb_eArgError, "accept 1 or 2 arguments: (int32[, seed])"); } _int = NUM2UINT(argv[0]); MurmurHash3_x64_128(&_int, 4, argc == 1 ? 0 : NUM2UINT(argv[1]), result); #if WORDS_BIGENDIAN SWAP_128_BIT(); #endif RETURN_128_BIT(); } |
#murmur3_128_int64_hash(*args) ⇒ Object
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 |
# File 'ext/murmur_native/murmur_native.c', line 413 static VALUE rb_murmur3_128_int64_hash(int argc, VALUE* argv, VALUE self) { VALUE ar_result; uint32_t result[4]; uint64_t _int; if (argc == 0 || argc > 2) { rb_raise(rb_eArgError, "accept 1 or 2 arguments: (int64[, seed])"); } #if SIZEOF_LONG == 8 _int = NUM2ULONG(argv[0]); #else _int = NUM2ULL(argv[0]); #endif MurmurHash3_x64_128(&_int, 8, argc == 1 ? 0 : NUM2UINT(argv[1]), result); #if WORDS_BIGENDIAN SWAP_128_BIT(); #endif RETURN_128_BIT(); } |
#murmur3_128_str_hash(*args) ⇒ Object
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'ext/murmur_native/murmur_native.c', line 377 static VALUE rb_murmur3_128_str_hash(int argc, VALUE* argv, VALUE self) { VALUE rstr, ar_result; uint32_t result[4]; if (argc == 0 || argc > 2) { rb_raise(rb_eArgError, "accept 1 or 2 arguments: (string[, seed])"); } rstr = argv[0]; StringValue(rstr); MurmurHash3_x64_128(RSTRING_PTR(rstr), RSTRING_LEN(rstr), argc == 1 ? 0 : NUM2UINT(argv[1]), result); #if WORDS_BIGENDIAN SWAP_128_BIT(); #endif RETURN_128_BIT(); } |