aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-02-20 20:42:10 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-02-20 20:42:10 +0000
commit61eb180a53320c113fee615bb9d459624e2817f7 (patch)
tree0666e0b7bec9a31713864c2d3b5d4ed187e1b771 /lib/Support/APInt.cpp
parent580546a82bdf65148d19e68296ae51cea5ad9ef2 (diff)
Clean up variable names in operator*.
Attempt #3 for getting a portable INFINITY value. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r--lib/Support/APInt.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp
index 51a1c147f0..9d43ae4f16 100644
--- a/lib/Support/APInt.cpp
+++ b/lib/Support/APInt.cpp
@@ -17,7 +17,6 @@
#include "llvm/Support/MathExtras.h"
#include <cstring>
#include <cstdlib>
-#include <cmath>
using namespace llvm;
// A utility function for allocating memory, checking for allocation failures,
@@ -331,7 +330,8 @@ static void mul(uint64_t dest[], uint64_t x[], uint32_t xlen,
/// given APInt& RHS and assigns the result to this APInt.
APInt& APInt::operator*=(const APInt& RHS) {
assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
- if (isSingleWord()) VAL *= RHS.isSingleWord() ? RHS.VAL : RHS.pVal[0];
+ if (isSingleWord())
+ VAL *= RHS.VAL;
else {
// one-based first non-zero bit position.
uint32_t first = getActiveBits();
@@ -456,10 +456,10 @@ bool APInt::operator !() const {
/// RHS.
APInt APInt::operator*(const APInt& RHS) const {
assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
- APInt API(RHS);
- API *= *this;
- API.clearUnusedBits();
- return API;
+ APInt Result(*this);
+ Result *= RHS;
+ Result.clearUnusedBits();
+ return Result;
}
/// @brief Addition operator. Adds this APInt by the given APInt& RHS.
@@ -838,9 +838,9 @@ double APInt::roundToDouble(bool isSigned) const {
// Return infinity for exponent overflow
if (exp > 1023) {
if (!isSigned || !isNeg)
- return double(INFINITY); // positive infinity
+ return double(1.0E300 * 1.0E300); // positive infinity
else
- return double(-INFINITY); // negative infinity
+ return double(-1.0E300 * 1.0E300); // negative infinity
}
exp += 1023; // Increment for 1023 bias