You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
539 B
20 lines
539 B
4 weeks ago
|
'use strict';
|
||
|
var $ = require('../internals/export');
|
||
|
|
||
|
// `Math.imulh` method
|
||
|
// https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
||
|
// TODO: Remove from `core-js@4`
|
||
|
$({ target: 'Math', stat: true, forced: 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);
|
||
|
}
|
||
|
});
|