aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-04-01 18:45:54 +0000
committerDan Gohman <gohman@apple.com>2009-04-01 18:45:54 +0000
commitcff6953c456fb359c971c3b0ae263d19ea4b4ae4 (patch)
treeaeb306a7c6461dd65eb8080f8b1c0ee057859521 /llvm/lib/Support/APInt.cpp
parent7fdda1d695132fc22ffc4d3abbeb6b13ce8d04d9 (diff)
downloadllvm-cff6953c456fb359c971c3b0ae263d19ea4b4ae4.zip
llvm-cff6953c456fb359c971c3b0ae263d19ea4b4ae4.tar.gz
llvm-cff6953c456fb359c971c3b0ae263d19ea4b4ae4.tar.bz2
Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented calculations from target-oriented calculations. llvm-svn: 68227
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index ae9b066..1cabe0f 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1631,7 +1631,7 @@ void APInt::divide(const APInt LHS, unsigned lhsWords,
// can't use 64-bit operands here because we don't have native results of
// 128-bits. Furthermore, casting the 64-bit values to 32-bit values won't
// work on large-endian machines.
- uint64_t mask = ~0ull >> (sizeof(unsigned)*8);
+ uint64_t mask = ~0ull >> (sizeof(unsigned)*CHAR_BIT);
unsigned n = rhsWords * 2;
unsigned m = (lhsWords * 2) - n;
@@ -1661,7 +1661,7 @@ void APInt::divide(const APInt LHS, unsigned lhsWords,
for (unsigned i = 0; i < lhsWords; ++i) {
uint64_t tmp = (LHS.getNumWords() == 1 ? LHS.VAL : LHS.pVal[i]);
U[i * 2] = (unsigned)(tmp & mask);
- U[i * 2 + 1] = (unsigned)(tmp >> (sizeof(unsigned)*8));
+ U[i * 2 + 1] = (unsigned)(tmp >> (sizeof(unsigned)*CHAR_BIT));
}
U[m+n] = 0; // this extra word is for "spill" in the Knuth algorithm.
@@ -1670,7 +1670,7 @@ void APInt::divide(const APInt LHS, unsigned lhsWords,
for (unsigned i = 0; i < rhsWords; ++i) {
uint64_t tmp = (RHS.getNumWords() == 1 ? RHS.VAL : RHS.pVal[i]);
V[i * 2] = (unsigned)(tmp & mask);
- V[i * 2 + 1] = (unsigned)(tmp >> (sizeof(unsigned)*8));
+ V[i * 2 + 1] = (unsigned)(tmp >> (sizeof(unsigned)*CHAR_BIT));
}
// initialize the quotient and remainder