diff options
author | Jeff Cohen <jeffc@jolt-lang.org> | 2007-03-05 00:00:42 +0000 |
---|---|---|
committer | Jeff Cohen <jeffc@jolt-lang.org> | 2007-03-05 00:00:42 +0000 |
commit | ca5183d445954a9b2a570d6bbba1bc2b00ad6442 (patch) | |
tree | 2fe70b0a35fe2569c8d6434e9769bc6e8bd58204 /lib/Support/APInt.cpp | |
parent | f298fd0428e3e26fda13d24bb7295c416a9b8452 (diff) |
Unbreak VC++ build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r-- | lib/Support/APInt.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 683211b451..08ec236200 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -17,6 +17,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" +#include <math.h> #include <cstring> #include <cstdlib> #ifndef NDEBUG @@ -1224,9 +1225,16 @@ APInt APInt::sqrt() const { // an IEEE double precision floating point value), then we can use the // libc sqrt function which will probably use a hardware sqrt computation. // This should be faster than the algorithm below. - if (magnitude < 52) + if (magnitude < 52) { +#ifdef _MSC_VER + // Amazingly, VC++ doesn't have round(). + return APInt(BitWidth, + uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5); +#else return APInt(BitWidth, uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0]))))); +#endif + } // Okay, all the short cuts are exhausted. We must compute it. The following // is a classical Babylonian method for computing the square root. This code |