From 89253d33c25793bdf1b09678ab285c6c0c73ce67 Mon Sep 17 00:00:00 2001 From: "lrn@chromium.org" Date: Tue, 27 Oct 2009 12:26:21 +0000 Subject: [PATCH] Fixed problem with test on big-endian-float ARM. Review URL: http://codereview.chromium.org/338044 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3143 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- test/cctest/test-api.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 7ec5e64dc1..22b9477c65 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -8499,14 +8499,28 @@ THREADED_TEST(GetHeapStatistics) { 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(&value) + kIntSize, kIntSize); + memcpy(reinterpret_cast(&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(&value) + kIntSize, kIntSize); + memcpy(reinterpret_cast(&target) + kIntSize, &value, kIntSize); +#else memcpy(&target, &value, sizeof(target)); +#endif return target; }