Skip to content

Commit

Permalink
Overwrite Math.imul in Safari 8 to report the correct length.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Apr 10, 2015
1 parent 55dc1fa commit b1f05fb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions es6-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -1570,9 +1570,18 @@
}, !roundHandlesBoundaryConditions || !roundDoesNotIncreaseIntegers);
Value.preserveToString(Math.round, origMathRound);

var origImul = Math.imul;
if (Math.imul(0xffffffff, 5) !== -5) {
// Safari 6.1, at least, reports "0" for this value
Math.imul = MathShims.imul;
Value.preserveToString(Math.imul, origImul);
}
if (Math.imul.length !== 2) {
// Safari 8 has a length of 1
defineProperty(Math, 'imul', function imul(x, y) {
return origImul.apply(Math, arguments);
}, true);
Value.preserveToString(Math.imul, origImul);
}

// Promises
Expand Down

0 comments on commit b1f05fb

Please sign in to comment.