UNPKG

@grafana/flamegraph

Version:

Grafana flamegraph visualization component

55 lines (53 loc) 1.67 kB
function murmurhash3_32_gc(key, seed = 0) { let remainder; let bytes; let h1; let h1b; let c1; let c2; let k1; let i; remainder = key.length & 3; bytes = key.length - remainder; h1 = seed; c1 = 3432918353; c2 = 461845907; i = 0; while (i < bytes) { k1 = key.charCodeAt(i) & 255 | (key.charCodeAt(++i) & 255) << 8 | (key.charCodeAt(++i) & 255) << 16 | (key.charCodeAt(++i) & 255) << 24; ++i; k1 = (k1 & 65535) * c1 + (((k1 >>> 16) * c1 & 65535) << 16) & 4294967295; k1 = k1 << 15 | k1 >>> 17; k1 = (k1 & 65535) * c2 + (((k1 >>> 16) * c2 & 65535) << 16) & 4294967295; h1 ^= k1; h1 = h1 << 13 | h1 >>> 19; h1b = (h1 & 65535) * 5 + (((h1 >>> 16) * 5 & 65535) << 16) & 4294967295; h1 = (h1b & 65535) + 27492 + (((h1b >>> 16) + 58964 & 65535) << 16); } k1 = 0; switch (remainder) { case 3: k1 ^= (key.charCodeAt(i + 2) & 255) << 16; // fall through case 2: k1 ^= (key.charCodeAt(i + 1) & 255) << 8; // fall through case 1: k1 ^= key.charCodeAt(i) & 255; // fall through default: k1 = (k1 & 65535) * c1 + (((k1 >>> 16) * c1 & 65535) << 16) & 4294967295; k1 = k1 << 15 | k1 >>> 17; k1 = (k1 & 65535) * c2 + (((k1 >>> 16) * c2 & 65535) << 16) & 4294967295; h1 ^= k1; } h1 ^= key.length; h1 ^= h1 >>> 16; h1 = (h1 & 65535) * 2246822507 + (((h1 >>> 16) * 2246822507 & 65535) << 16) & 4294967295; h1 ^= h1 >>> 13; h1 = (h1 & 65535) * 3266489909 + (((h1 >>> 16) * 3266489909 & 65535) << 16) & 4294967295; h1 ^= h1 >>> 16; return h1 >>> 0; } export { murmurhash3_32_gc as default }; //# sourceMappingURL=murmur3.mjs.map