Reviewers: Sven Panne,

Description:
Force signed zero double.


[email protected]
BUG=v8:2239
TEST=


Please review this at https://chromiumcodereview.appspot.com/10821088/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/conversions.h


Index: src/conversions.h
diff --git a/src/conversions.h b/src/conversions.h
index e12cf5cdfc785b5b3b96e051a3b2799a7497bfed..f612b4b391a3eb1a65d059f9b83ea03a18bdc663 100644
--- a/src/conversions.h
+++ b/src/conversions.h
@@ -53,7 +53,10 @@ inline bool isDigit(int x, int radix) {


 inline double SignedZero(bool negative) {
-  return negative ? -0.0 : 0.0;
+  // -0.0 according to IEEE 754 only has the (uppermost) sign bit set.
+  static const uint64_t kSignedZeroInt64 = static_cast<uint64_t>(1) << 63;
+ static const double kSignedZero = BitCast<double, uint64_t>(kSignedZeroInt64);
+  return negative ? kSignedZero : 0.0;
 }




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to