diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-15 17:11:55 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-15 17:11:55 +0000 |
commit | 9e01b615a43803d8cb61dc3d05e6c053f2141cc7 (patch) | |
tree | 144405260ac19dc0bceeae42400e0bff83ef365b /llvm/lib/Support | |
parent | 93cd0f1c890846012c88a9fce471daa191b68a41 (diff) | |
download | bcm5719-llvm-9e01b615a43803d8cb61dc3d05e6c053f2141cc7.tar.gz bcm5719-llvm-9e01b615a43803d8cb61dc3d05e6c053f2141cc7.zip |
improve portability to systems that don't have round, patch by
Evzen Muller!
llvm-svn: 103877
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 50025d214bc..1341d214370 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -1382,13 +1382,12 @@ APInt APInt::sqrt() const { // libc sqrt function which will probably use a hardware sqrt computation. // This should be faster than the algorithm below. if (magnitude < 52) { -#if defined( _MSC_VER ) || defined(_MINIX) - // Amazingly, VC++ and Minix don't have round(). +#if HAVE_ROUND return APInt(BitWidth, - uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5); + uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0]))))); #else return APInt(BitWidth, - uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0]))))); + uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5); #endif } |