MCPcopy Create free account
hub / github.com/apache/fory / mul64

Function mul64

javascript/packages/core/lib/murmurHash3.ts:53–86  ·  view source on GitHub ↗
(m: u64, n: u64)

Source from the content-addressed store, hash-verified

51}
52
53function mul64(m: u64, n: u64): u64 {
54 const ms: u64spill = [m[0] >>> 16, m[0] & 0xffff, m[1] >>> 16, m[1] & 0xffff];
55 const ns: u64spill = [n[0] >>> 16, n[0] & 0xffff, n[1] >>> 16, n[1] & 0xffff];
56 const os: u64spill = [0x0, 0x0, 0x0, 0x0];
57
58 os[3] += ms[3] * ns[3];
59 os[2] += os[3] >>> 16;
60 os[3] &= 0xffff;
61
62 os[2] += ms[2] * ns[3];
63 os[1] += os[2] >>> 16;
64 os[2] &= 0xffff;
65
66 os[2] += ms[3] * ns[2];
67 os[1] += os[2] >>> 16;
68 os[2] &= 0xffff;
69
70 os[1] += ms[1] * ns[3];
71 os[0] += os[1] >>> 16;
72 os[1] &= 0xffff;
73
74 os[1] += ms[2] * ns[2];
75 os[0] += os[1] >>> 16;
76 os[1] &= 0xffff;
77
78 os[1] += ms[3] * ns[1];
79 os[0] += os[1] >>> 16;
80 os[1] &= 0xffff;
81
82 os[0] += (ms[0] * ns[3]) + (ms[1] * ns[2]) + (ms[2] * ns[1]) + (ms[3] * ns[0]);
83 os[0] &= 0xffff;
84
85 return [(os[0] << 16) | os[1], (os[2] << 16) | os[3]];
86}
87
88function rol64(n: u64, r: number): u64 {
89 r %= 64;

Callers 3

x64fmix64Function · 0.85
x64mix128Function · 0.85
x64hash128Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected