Fix a bug in RoundDoubleToAPInt where it would force the size to 64 bits
authorReid Spencer <rspencer@reidspencer.com>
Wed, 28 Feb 2007 01:30:08 +0000 (01:30 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Wed, 28 Feb 2007 01:30:08 +0000 (01:30 +0000)
instead of honoring the client's requested bit width.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34712 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index f38029ac8f21c8461dd59f85602fa0a0fe4547fe..f965625450313e9d0b5f9dadf50d7dc9236b0546 100644 (file)
@@ -808,7 +808,7 @@ APInt llvm::APIntOps::RoundDoubleToAPInt(double Double, uint32_t width) {
 
   // If the exponent is negative, the value is < 0 so just return 0.
   if (exp < 0)
-    return APInt(64u, 0u);
+    return APInt(width, 0u);
 
   // Extract the mantissa by clearing the top 12 bits (sign + exponent).
   uint64_t mantissa = (T.I & (~0ULL >> 12)) | 1ULL << 52;