es7.math.umulh.js 448 B

12345678910111213141516
  1. // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
  2. var $export = require('./_export');
  3. $export($export.S, 'Math', {
  4. umulh: function umulh(u, v) {
  5. var UINT16 = 0xffff;
  6. var $u = +u;
  7. var $v = +v;
  8. var u0 = $u & UINT16;
  9. var v0 = $v & UINT16;
  10. var u1 = $u >>> 16;
  11. var v1 = $v >>> 16;
  12. var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
  13. return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
  14. }
  15. });