Unbreak VC++ build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34917 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jeff Cohen
2007-03-05 00:00:42 +00:00
parent f298fd0428
commit ca5183d445
26 changed files with 173 additions and 60 deletions
+9 -1
View File
@@ -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