function murmurhash2_x86_32(str, seed = 0) {
    throwInvalidStringHash(str, "murmurhash2_x86_32");
    throwInvalidMurmurSeed(seed);

    const hash = toUtf8Bytes(str);
    let currentIndex = 0;
    let hashSum = seed ^ hash.length;
    let length = hash.length;

    while (length >= 4) {
      let calculated = uInt32Getter(hash, currentIndex);

      calculated = uMul32Getter(calculated, MULTIPLIER);
      calculated ^= calculated >>> BASE;
      calculated = uMul32Getter(calculated, MULTIPLIER);

      hashSum = uMul32Getter(hashSum, MULTIPLIER);
      hashSum ^= calculated;

      currentIndex += 4;
      length -= 4;
    }

    switch (length) {
      case 3:
        hashSum ^= uInt16Getter(hash, currentIndex);
        hashSum ^= hash[currentIndex + 2] << 16;
        hashSum = uMul32Getter(hashSum, MULTIPLIER);
        break;
      case 2:
        hashSum ^= uInt16Getter(hash, currentIndex);
        hashSum = uMul32Getter(hashSum, MULTIPLIER);
        break;
      case 1:
        hashSum ^= hash[currentIndex];
        hashSum = uMul32Getter(hashSum, MULTIPLIER);
        break;
    }

    hashSum ^= hashSum >>> 13;
    hashSum = uMul32Getter(hashSum, MULTIPLIER);
    hashSum ^= hashSum >>> 15;

    return hashSum >>> 0;
  }
/**
   * Generate a non-cryptic 32 bit number hash for x86 with murmur2 algorithm.
   *
   * @throws {TypeError} Throws an exception if hash is not a string
   * @throws {TypeError} Throws an exception if seed is a float
   * @param {string} str The base string hash to generate number
   * @param {number} [seed=0] An optional seed value
   * @return {number} Generated number
   */
Generate a non-cryptic 32 bit number hash for x86 with murmur2 algorithm.
Generate a non - cryptic 32 bit number hash for x86 with murmur2 algorithm .
function murmurhash2_x86_32(str, seed = 0) {
    throwInvalidStringHash(str, "murmurhash2_x86_32");
    throwInvalidMurmurSeed(seed);
    const hash = toUtf8Bytes(str);
    let currentIndex = 0;
    let hashSum = seed ^ hash.length;
    let length = hash.length;
    while (length >= 4) {
      let calculated = uInt32Getter(hash, currentIndex);
      calculated = uMul32Getter(calculated, MULTIPLIER);
      calculated ^= calculated >>> BASE;
      calculated = uMul32Getter(calculated, MULTIPLIER);
      hashSum = uMul32Getter(hashSum, MULTIPLIER);
      hashSum ^= calculated;
      currentIndex += 4;
      length -= 4;
    }
    switch (length) {
      case 3:
        hashSum ^= uInt16Getter(hash, currentIndex);
        hashSum ^= hash[currentIndex + 2] << 16;
        hashSum = uMul32Getter(hashSum, MULTIPLIER);
        break;
      case 2:
        hashSum ^= uInt16Getter(hash, currentIndex);
        hashSum = uMul32Getter(hashSum, MULTIPLIER);
        break;
      case 1:
        hashSum ^= hash[currentIndex];
        hashSum = uMul32Getter(hashSum, MULTIPLIER);
        break;
    }
    hashSum ^= hashSum >>> 13;
    hashSum = uMul32Getter(hashSum, MULTIPLIER);
    hashSum ^= hashSum >>> 15;
    return hashSum >>> 0;
  }
function murmurhash2_x86_32 ( str , seed = 0 ) { throwInvalidStringHash ( str , "murmurhash2_x86_32" ) ; throwInvalidMurmurSeed ( seed ) ; const hash = toUtf8Bytes ( str ) ; let currentIndex = 0 ; let hashSum = seed ^ hash . length ; let length = hash . length ; while ( length >= 4 ) { let calculated = uInt32Getter ( hash , currentIndex ) ; calculated = uMul32Getter ( calculated , MULTIPLIER ) ; calculated ^= calculated >>> BASE ; calculated = uMul32Getter ( calculated , MULTIPLIER ) ; hashSum = uMul32Getter ( hashSum , MULTIPLIER ) ; hashSum ^= calculated ; currentIndex += 4 ; length -= 4 ; } switch ( length ) { case 3 : hashSum ^= uInt16Getter ( hash , currentIndex ) ; hashSum ^= hash [ currentIndex + 2 ] << 16 ; hashSum = uMul32Getter ( hashSum , MULTIPLIER ) ; break ; case 2 : hashSum ^= uInt16Getter ( hash , currentIndex ) ; hashSum = uMul32Getter ( hashSum , MULTIPLIER ) ; break ; case 1 : hashSum ^= hash [ currentIndex ] ; hashSum = uMul32Getter ( hashSum , MULTIPLIER ) ; break ; } hashSum ^= hashSum >>> 13 ; hashSum = uMul32Getter ( hashSum , MULTIPLIER ) ; hashSum ^= hashSum >>> 15 ; return hashSum >>> 0 ; }
Generate a non-cryptic 32 bit number hash for x86 with murmur2 algorithm.
Generate a non - cryptic 32 bit number hash for x86 with murmur2 algorithm .