2017-05-28 00:38:50 +02:00
|
|
|
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
|
|
|
var $export = require('./_export');
|
|
|
|
|
|
|
|
$export($export.S, 'Math', {
|
2017-08-14 05:01:11 +02:00
|
|
|
umulh: function umulh(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);
|
2017-05-28 00:38:50 +02:00
|
|
|
return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
|
|
|
|
}
|
2017-08-14 05:01:11 +02:00
|
|
|
});
|