1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function murmurhash2_32_gc(str) {
|
18 | var l = str.length;
|
19 | var h = l;
|
20 | var i = 0;
|
21 | var k = void 0;
|
22 |
|
23 | while (l >= 4) {
|
24 | k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
25 |
|
26 | k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
27 | k ^= k >>> 24;
|
28 | k = (k & 0xffff) * 0x5bd1e995 + (((k >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
29 |
|
30 | h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16) ^ k;
|
31 |
|
32 | l -= 4;
|
33 | ++i;
|
34 | }
|
35 |
|
36 | switch (l) {
|
37 | case 3:
|
38 | h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
39 | case 2:
|
40 | h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
41 | case 1:
|
42 | h ^= str.charCodeAt(i) & 0xff;
|
43 | h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
44 | }
|
45 |
|
46 |
|
47 | h ^= h >>> 13;
|
48 | h = (h & 0xffff) * 0x5bd1e995 + (((h >>> 16) * 0x5bd1e995 & 0xffff) << 16);
|
49 | h ^= h >>> 15;
|
50 |
|
51 | return (h >>> 0).toString(36);
|
52 | }
|
53 |
|
54 | exports.default = murmurhash2_32_gc; |
\ | No newline at end of file |