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 | 4aa36aea226ae32591827a87269c35831850c769 (patch) | |
| tree | c16885feef192d37f9e34f24f9c85e46b9794eb0 /lib/Support/APInt.cpp | |
| parent | 90131ba41b81e394bcea8f19229c4cfcfdec25a6 (diff) | |
| download | external_llvm-4aa36aea226ae32591827a87269c35831850c769.zip external_llvm-4aa36aea226ae32591827a87269c35831850c769.tar.gz external_llvm-4aa36aea226ae32591827a87269c35831850c769.tar.bz2 | |
improve portability to systems that don't have round, patch by
Evzen Muller!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
| -rw-r--r-- | lib/Support/APInt.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 50025d2..1341d21 100644 --- a/lib/Support/APInt.cpp +++ b/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 } |
