Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
511 bytes
|
Line | |
---|
1 | var $ = require('../internals/export');
|
---|
2 |
|
---|
3 | // `Math.imulh` method
|
---|
4 | // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
|
---|
5 | // TODO: Remove from `core-js@4`
|
---|
6 | $({ target: 'Math', stat: true }, {
|
---|
7 | imulh: function imulh(u, v) {
|
---|
8 | var UINT16 = 0xFFFF;
|
---|
9 | var $u = +u;
|
---|
10 | var $v = +v;
|
---|
11 | var u0 = $u & UINT16;
|
---|
12 | var v0 = $v & UINT16;
|
---|
13 | var u1 = $u >> 16;
|
---|
14 | var v1 = $v >> 16;
|
---|
15 | var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
|
---|
16 | return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
|
---|
17 | }
|
---|
18 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.