Revision: 3143
Author: [email protected]
Date: Tue Oct 27 05:26:21 2009
Log: Fixed problem with test on big-endian-float ARM.

Review URL: http://codereview.chromium.org/338044

http://code.google.com/p/v8/source/detail?r=3143

Modified:
  /branches/bleeding_edge/test/cctest/test-api.cc

=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Tue Oct 27 01:13:59 2009
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Tue Oct 27 05:26:21 2009
@@ -8499,14 +8499,28 @@

  static double DoubleFromBits(uint64_t value) {
    double target;
+#ifdef BIG_ENDIAN_FLOATING_POINT
+  const int kIntSize = 4;
+  // Somebody swapped the lower and higher half of doubles.
+  memcpy(&target, reinterpret_cast<char*>(&value) + kIntSize, kIntSize);
+  memcpy(reinterpret_cast<char*>(&target) + kIntSize, &value, kIntSize);
+#else
    memcpy(&target, &value, sizeof(target));
+#endif
    return target;
  }


  static uint64_t DoubleToBits(double value) {
    uint64_t target;
+#ifdef BIG_ENDIAN_FLOATING_POINT
+  const int kIntSize = 4;
+  // Somebody swapped the lower and higher half of doubles.
+  memcpy(&target, reinterpret_cast<char*>(&value) + kIntSize, kIntSize);
+  memcpy(reinterpret_cast<char*>(&target) + kIntSize, &value, kIntSize);
+#else
    memcpy(&target, &value, sizeof(target));
+#endif
    return target;
  }


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

Reply via email to