pub fn hash3_x64_128(mut data: &[u8]) -> i128 {
    let length = data.len();

    let c1: Wrapping<i64> = Wrapping(0x87c3_7b91_1142_53d5_u64 as i64);
    let c2: Wrapping<i64> = Wrapping(0x4cf5_ad43_2745_937f_u64 as i64);

    let mut h1 = Wrapping(0_i64);
    let mut h2 = Wrapping(0_i64);

    while data.len() >= 16 {
        let mut k1 = Wrapping(data.get_i64_le());
        let mut k2 = Wrapping(data.get_i64_le());

        k1 *= c1;
        k1 = rotl64(k1, 31);
        k1 *= c2;
        h1 ^= k1;

        h1 = rotl64(h1, 27);
        h1 += h2;
        h1 = h1 * Wrapping(5) + Wrapping(0x52dce729);

        k2 *= c2;
        k2 = rotl64(k2, 33);
        k2 *= c1;
        h2 ^= k2;

        h2 = rotl64(h2, 31);
        h2 += h1;
        h2 = h2 * Wrapping(5) + Wrapping(0x38495ab5);
    }

    let mut k1 = Wrapping(0_i64);
    let mut k2 = Wrapping(0_i64);

    debug_assert!(data.len() < 16);

    if data.len() > 8 {
        for i in (8..data.len()).rev() {
            k2 ^= Wrapping(data[i] as i8 as i64) << ((i - 8) * 8);
        }

        k2 *= c2;
        k2 = rotl64(k2, 33);
        k2 *= c1;
        h2 ^= k2;
    }

    if !data.is_empty() {
        for i in (0..std::cmp::min(8, data.len())).rev() {
            k1 ^= Wrapping(data[i] as i8 as i64) << (i * 8);
        }

        k1 *= c1;
        k1 = rotl64(k1, 31);
        k1 *= c2;
        h1 ^= k1;
    }

    h1 ^= Wrapping(length as i64);
    h2 ^= Wrapping(length as i64);

    h1 += h2;
    h2 += h1;

    h1 = fmix(h1);
    h2 = fmix(h2);

    h1 += h2;
    h2 += h1;

    ((h2.0 as i128) << 64) | h1.0 as i128
}
// An implementation of MurmurHash3 ported from Scylla. Please note that this
// is not a "correct" implementation of MurmurHash3 - it replicates the same
// bugs made in the original Cassandra implementation in order to be compatible.
An implementation of MurmurHash3 ported from Scylla. Please note that this
is not a "correct" implementation of MurmurHash3 - it replicates the same
bugs made in the original Cassandra implementation in order to be compatible.
An implementation of MurmurHash3 ported from Scylla . Please note that this is not a " correct " implementation of MurmurHash3 - it replicates the same bugs made in the original Cassandra implementation in order to be compatible .
pub fn hash3_x64_128(mut data: &[u8]) -> i128 {
    let length = data.len();
    let c1: Wrapping<i64> = Wrapping(0x87c3_7b91_1142_53d5_u64 as i64);
    let c2: Wrapping<i64> = Wrapping(0x4cf5_ad43_2745_937f_u64 as i64);
    let mut h1 = Wrapping(0_i64);
    let mut h2 = Wrapping(0_i64);
    while data.len() >= 16 {
        let mut k1 = Wrapping(data.get_i64_le());
        let mut k2 = Wrapping(data.get_i64_le());
        k1 *= c1;
        k1 = rotl64(k1, 31);
        k1 *= c2;
        h1 ^= k1;
        h1 = rotl64(h1, 27);
        h1 += h2;
        h1 = h1 * Wrapping(5) + Wrapping(0x52dce729);
        k2 *= c2;
        k2 = rotl64(k2, 33);
        k2 *= c1;
        h2 ^= k2;
        h2 = rotl64(h2, 31);
        h2 += h1;
        h2 = h2 * Wrapping(5) + Wrapping(0x38495ab5);
    }
    let mut k1 = Wrapping(0_i64);
    let mut k2 = Wrapping(0_i64);
    debug_assert!(data.len() < 16);
    if data.len() > 8 {
        for i in (8..data.len()).rev() {
            k2 ^= Wrapping(data[i] as i8 as i64) << ((i - 8) * 8);
        }
        k2 *= c2;
        k2 = rotl64(k2, 33);
        k2 *= c1;
        h2 ^= k2;
    }
    if !data.is_empty() {
        for i in (0..std::cmp::min(8, data.len())).rev() {
            k1 ^= Wrapping(data[i] as i8 as i64) << (i * 8);
        }
        k1 *= c1;
        k1 = rotl64(k1, 31);
        k1 *= c2;
        h1 ^= k1;
    }
    h1 ^= Wrapping(length as i64);
    h2 ^= Wrapping(length as i64);
    h1 += h2;
    h2 += h1;
    h1 = fmix(h1);
    h2 = fmix(h2);
    h1 += h2;
    h2 += h1;
    ((h2.0 as i128) << 64) | h1.0 as i128
}
pub fn hash3_x64_128 ( mut data : & [ u8 ] ) -> i128 { let length = data . len ( ) ; let c1 : Wrapping < i64 > = Wrapping ( 0x87c3_7b91_1142_53d5_u64 as i64 ) ; let c2 : Wrapping < i64 > = Wrapping ( 0x4cf5_ad43_2745_937f_u64 as i64 ) ; let mut h1 = Wrapping ( 0_i64 ) ; let mut h2 = Wrapping ( 0_i64 ) ; while data . len ( ) >= 16 { let mut k1 = Wrapping ( data . get_i64_le ( ) ) ; let mut k2 = Wrapping ( data . get_i64_le ( ) ) ; k1 *= c1 ; k1 = rotl64 ( k1 , 31 ) ; k1 *= c2 ; h1 ^= k1 ; h1 = rotl64 ( h1 , 27 ) ; h1 += h2 ; h1 = h1 * Wrapping ( 5 ) + Wrapping ( 0x52dce729 ) ; k2 *= c2 ; k2 = rotl64 ( k2 , 33 ) ; k2 *= c1 ; h2 ^= k2 ; h2 = rotl64 ( h2 , 31 ) ; h2 += h1 ; h2 = h2 * Wrapping ( 5 ) + Wrapping ( 0x38495ab5 ) ; } let mut k1 = Wrapping ( 0_i64 ) ; let mut k2 = Wrapping ( 0_i64 ) ; debug_assert ! ( data len ( ) 16 ) ; if data . len ( ) > 8 { for i in ( 8 .. data . len ( ) ) . rev ( ) { k2 ^= Wrapping ( data [ i ] as i8 as i64 ) << ( ( i - 8 ) * 8 ) ; } k2 *= c2 ; k2 = rotl64 ( k2 , 33 ) ; k2 *= c1 ; h2 ^= k2 ; } if ! data . is_empty ( ) { for i in ( 0 .. std :: cmp :: min ( 8 , data . len ( ) ) ) . rev ( ) { k1 ^= Wrapping ( data [ i ] as i8 as i64 ) << ( i * 8 ) ; } k1 *= c1 ; k1 = rotl64 ( k1 , 31 ) ; k1 *= c2 ; h1 ^= k1 ; } h1 ^= Wrapping ( length as i64 ) ; h2 ^= Wrapping ( length as i64 ) ; h1 += h2 ; h2 += h1 ; h1 = fmix ( h1 ) ; h2 = fmix ( h2 ) ; h1 += h2 ; h2 += h1 ; ( ( h2 . 0 as i128 ) << 64 ) | h1 . 0 as i128 }
An implementation of MurmurHash3 ported from Scylla.
An implementation of MurmurHash3 ported from Scylla .
data
&[u8]
data
&[u8]