1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 19:23:18 +00:00
musix-oss/node_modules/core-js/modules/esnext.math.imulh.js

18 lines
478 B
JavaScript
Raw Normal View History

2019-10-10 13:43:04 +00:00
var $ = require('../internals/export');
// `Math.imulh` method
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
$({ target: 'Math', stat: true }, {
imulh: function imulh(u, v) {
var UINT16 = 0xFFFF;
var $u = +u;
var $v = +v;
var u0 = $u & UINT16;
var v0 = $v & UINT16;
var u1 = $u >> 16;
var v1 = $v >> 16;
var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
}
});