From c6b9ff11696c6d18bf9493dabd375ea497f34ff3 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Sat, 14 May 2011 14:33:56 +0000 Subject: [PATCH] Correction to hexfloat hack. llvm-svn: 131340 --- libcxx/test/hexfloat.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libcxx/test/hexfloat.h b/libcxx/test/hexfloat.h index 907de02c584f..7ef093714fed 100644 --- a/libcxx/test/hexfloat.h +++ b/libcxx/test/hexfloat.h @@ -24,11 +24,12 @@ class hexfloat { T value_; public: - hexfloat(unsigned long long m1, unsigned long long m0, int exp) + hexfloat(long long m1, unsigned long long m0, int exp) { const std::size_t n = sizeof(unsigned long long) * CHAR_BIT; - value_ = std::ldexp(m1 + std::ldexp(T(m0), -static_cast(n - - std::__clz(m0))), exp); + int s = m1 < 0 ? -1 : 1; + value_ = std::ldexp(m1 + s * std::ldexp(T(m0), -static_cast(n - + std::__clz(m0)/4*4)), exp); } operator T() const {return value_;}