Avoid sign issues with the fast case code for Math.floor().
authorkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 15 Jun 2009 08:27:38 +0000 (08:27 +0000)
committerkasperl@chromium.org <kasperl@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 15 Jun 2009 08:27:38 +0000 (08:27 +0000)
Review URL: http://codereview.chromium.org/126115

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2161 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/math.js

index c8dd0cd5026feecc27c4c3d3b80cd67a5b944e49..81c15a714e193e8084fcda492e3d3b6d99d28428 100644 (file)
@@ -95,8 +95,8 @@ function MathExp(x) {
 // ECMA 262 - 15.8.2.9
 function MathFloor(x) {
   if (!IS_NUMBER(x)) x = ToNumber(x);
-  if (0 < x && x <= 0xFFFFFFFF) {
-    // Numbers in the range [0, 2^32) can be floored by converting
+  if (0 < x && x <= 0x7FFFFFFF) {
+    // Numbers in the range [0, 2^31) can be floored by converting
     // them to an unsigned 32-bit value using the shift operator.
     // We avoid doing so for -0, because the result of Math.floor(-0)
     // has to be -0, which wouldn't be the case with the shift.