aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-08-12 18:04:11 +0000
committerDale Johannesen <dalej@apple.com>2009-08-12 18:04:11 +0000
commit54be785be77bc19ad48f6ab3682932f62e80abb6 (patch)
tree3554eceae6d012abf914f51bd3c385dd3482d83d /llvm/lib/Support/APInt.cpp
parent91f5ff6bce50780482b1753dd4a3eb3e67fa1ccc (diff)
downloadllvm-54be785be77bc19ad48f6ab3682932f62e80abb6.zip
llvm-54be785be77bc19ad48f6ab3682932f62e80abb6.tar.gz
llvm-54be785be77bc19ad48f6ab3682932f62e80abb6.tar.bz2
Add attempted idiotproofing comment per review.
llvm-svn: 78825
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 6638fcc..daf2244 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -885,7 +885,7 @@ APInt llvm::APIntOps::RoundDoubleToAPInt(double Double, unsigned width) {
return isNeg ? -Tmp : Tmp;
}
-/// RoundToDouble - This function convert this APInt to a double.
+/// RoundToDouble - This function converts this APInt to a double.
/// The layout for double is as following (IEEE Standard 754):
/// --------------------------------------
/// | Sign Exponent Fraction Bias |
@@ -895,6 +895,7 @@ APInt llvm::APIntOps::RoundDoubleToAPInt(double Double, unsigned width) {
double APInt::roundToDouble(bool isSigned) const {
// Handle the simple case where the value is contained in one uint64_t.
+ // It is wrong to optimize getWord(0) to VAL; there might be more than one word.
if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
if (isSigned) {
int64_t sext = (int64_t(getWord(0)) << (64-BitWidth)) >> (64-BitWidth);