hypertune 0.6.2

Hypertune SDK for type safe configuration
Documentation
#![allow(overflowing_literals)]
pub fn hash(str: &str, seed: u32) -> u64 {
    let mut h1 = 0xdeadbeef ^ seed as i32;
    let mut h2 = 0x41c6ce57 ^ seed as i32;
    for ch in str.encode_utf16() {
        h1 = (h1 ^ ch as i32).wrapping_mul(2654435761);
        h2 = (h2 ^ ch as i32).wrapping_mul(1597334677);
    }

    // We cast to u32 to do an unsigned right shift, i.e. fill in with 0s rather
    // than 1s in twos complement.
    h1 = (h1 ^ (h1 as u32 >> 16) as i32).wrapping_mul(2246822507);
    h1 ^= (h2 ^ (h2 as u32 >> 13) as i32).wrapping_mul(3266489909);

    h2 = (h2 ^ (h2 as u32 >> 16) as i32).wrapping_mul(2246822507);
    h2 ^= (h1 ^ (h1 as u32 >> 13) as i32).wrapping_mul(3266489909);

    4294967296_u64
        .wrapping_mul((2097151_u32 & h2 as u32) as u64)
        // Cast to u32 because h1 >>> 0 in Javascript is the equivalent of
        // casting to a u32.
        .wrapping_add((h1 as u32) as u64)
}