[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Jeff Cohen
jeffc at jolt-lang.org
Sun Mar 4 16:02:04 PST 2007
Changes in directory llvm/lib/Support:
APInt.cpp updated: 1.68 -> 1.69
---
Log message:
Unbreak VC++ build.
---
Diffs of the changes: (+9 -1)
APInt.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletion(-)
Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.68 llvm/lib/Support/APInt.cpp:1.69
--- llvm/lib/Support/APInt.cpp:1.68 Fri Mar 2 16:39:11 2007
+++ llvm/lib/Support/APInt.cpp Sun Mar 4 18:00:42 2007
@@ -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 @@
// 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
More information about the llvm-commits
mailing list