frontend/.pnpm-store/v3/files/48/b5540a75d1a2a9046f2dd7c3e8c16d18fa2359f38bdfb637d4eed6bf4303205b872e4a3dee61dcfaa19569438874a0957d29a22c0cbc6f82bf351e50f681d0

18 lines
499 B
Plaintext

/* eslint no-bitwise: "off" */
// Thanks: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
// /Global_Objects/Math/imul
"use strict";
module.exports = function (val1, val2) {
var xh = (val1 >>> 16) & 0xffff
, xl = val1 & 0xffff
, yh = (val2 >>> 16) & 0xffff
, yl = val2 & 0xffff;
// The shift by 0 fixes the sign on the high part
// the final |0 converts the unsigned value into a signed value
return (xl * yl + (((xh * yl + xl * yh) << 16) >>> 0)) | 0;
};