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 | b622c11f775e0fb147a5487bc4345b813f5a47f0 (patch) | |
| tree | a749bc824452c7d96d1f99328e9761cd68e85a7d /llvm/lib/Support | |
| parent | 2fbcc0714c505fa6573709e987489cb6f698ab61 (diff) | |
| download | bcm5719-llvm-b622c11f775e0fb147a5487bc4345b813f5a47f0.tar.gz bcm5719-llvm-b622c11f775e0fb147a5487bc4345b813f5a47f0.zip | |
Unbreak VC++ build.
llvm-svn: 34917
Diffstat (limited to 'llvm/lib/Support')
| -rw-r--r-- | llvm/lib/Support/APInt.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 683211b451b..08ec2362007 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/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 |

