Index: test/cctest/test-api.cc |
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc |
index 7ec5e64dc12ceb5105193d9743209c5580da3141..2673c2dc29ba04d0544a4b2e3000cd8b33405a55 100644 |
--- a/test/cctest/test-api.cc |
+++ b/test/cctest/test-api.cc |
@@ -8498,15 +8498,29 @@ THREADED_TEST(GetHeapStatistics) { |
static double DoubleFromBits(uint64_t value) { |
+ const int kIntSize = 4; |
double target; |
+#ifdef BIG_ENDIAN_FLOATING_POINT |
+ // 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) { |
+ const int kIntSize = 4; |
uint64_t target; |
+#ifdef BIG_ENDIAN_FLOATING_POINT |
+ // 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; |
} |