[cfe-commits] [libcxx] r131340 - /libcxx/trunk/test/hexfloat.h

Howard Hinnant hhinnant at apple.com
Sat May 14 07:33:56 PDT 2011


Author: hhinnant
Date: Sat May 14 09:33:56 2011
New Revision: 131340

URL: http://llvm.org/viewvc/llvm-project?rev=131340&view=rev
Log:
Correction to hexfloat hack.

Modified:
    libcxx/trunk/test/hexfloat.h

Modified: libcxx/trunk/test/hexfloat.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/hexfloat.h?rev=131340&r1=131339&r2=131340&view=diff
==============================================================================
--- libcxx/trunk/test/hexfloat.h (original)
+++ libcxx/trunk/test/hexfloat.h Sat May 14 09:33:56 2011
@@ -24,11 +24,12 @@
 {
     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<int>(n -
-                                                         std::__clz(m0))), exp);
+        int s = m1 < 0 ? -1 : 1;
+        value_ = std::ldexp(m1 + s * std::ldexp(T(m0), -static_cast<int>(n -
+                                                     std::__clz(m0)/4*4)), exp);
     }
 
     operator T() const {return value_;}





More information about the cfe-commits mailing list