MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / murmurhash

Function murmurhash

code/styling/public/app.js:21651–21685  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

21649
21650// Source: https://github.com/garycourt/murmurhash-js/blob/master/murmurhash2_gc.js
21651function murmurhash(str) {
21652 var l = str.length | 0,
21653 h = l | 0,
21654 i = 0,
21655 k;
21656
21657 while (l >= 4) {
21658 k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
21659
21660 k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
21661 k ^= k >>> 24;
21662 k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
21663
21664 h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
21665
21666 l -= 4;
21667 ++i;
21668 }
21669
21670 switch (l) {
21671 case 3:
21672 h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
21673 case 2:
21674 h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
21675 case 1:
21676 h ^= str.charCodeAt(i) & 0xff;
21677 h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
21678 }
21679
21680 h ^= h >>> 13;
21681 h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
21682 h ^= h >>> 15;
21683
21684 return h >>> 0;
21685}
21686
21687//
21688var areStylesCacheable = IS_BROWSER;

Callers 3

generateRuleHashFunction · 0.85
app.jsFile · 0.85
injectGlobalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected