Node-Red configuration
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.

es.math.imul.js 716B

123456789101112131415161718192021222324
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var fails = require('../internals/fails');
  4. // eslint-disable-next-line es/no-math-imul -- required for testing
  5. var $imul = Math.imul;
  6. var FORCED = fails(function () {
  7. return $imul(0xFFFFFFFF, 5) !== -5 || $imul.length !== 2;
  8. });
  9. // `Math.imul` method
  10. // https://tc39.es/ecma262/#sec-math.imul
  11. // some WebKit versions fails with big numbers, some has wrong arity
  12. $({ target: 'Math', stat: true, forced: FORCED }, {
  13. imul: function imul(x, y) {
  14. var UINT16 = 0xFFFF;
  15. var xn = +x;
  16. var yn = +y;
  17. var xl = UINT16 & xn;
  18. var yl = UINT16 & yn;
  19. return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
  20. }
  21. });