diff options
author | David Greene <greened@obbligato.org> | 2010-01-05 01:28:52 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2010-01-05 01:28:52 +0000 |
commit | 465abed3880ee22981f7e9364159818079e46970 (patch) | |
tree | 104c2bdc2823581e9ed4462c263e5363205978af /lib/Support/APInt.cpp | |
parent | 8061a440f6cb54852079f7161f28e379c314475e (diff) |
Change errs() to dbgs().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92643 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r-- | lib/Support/APInt.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 9532e1e160..9d1468493d 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1580,12 +1580,12 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, uint64_t b = uint64_t(1) << 32; #if 0 - DEBUG(errs() << "KnuthDiv: m=" << m << " n=" << n << '\n'); - DEBUG(errs() << "KnuthDiv: original:"); - DEBUG(for (int i = m+n; i >=0; i--) errs() << " " << u[i]); - DEBUG(errs() << " by"); - DEBUG(for (int i = n; i >0; i--) errs() << " " << v[i-1]); - DEBUG(errs() << '\n'); + DEBUG(dbgs() << "KnuthDiv: m=" << m << " n=" << n << '\n'); + DEBUG(dbgs() << "KnuthDiv: original:"); + DEBUG(for (int i = m+n; i >=0; i--) dbgs() << " " << u[i]); + DEBUG(dbgs() << " by"); + DEBUG(for (int i = n; i >0; i--) dbgs() << " " << v[i-1]); + DEBUG(dbgs() << '\n'); #endif // D1. [Normalize.] Set d = b / (v[n-1] + 1) and multiply all the digits of // u and v by d. Note that we have taken Knuth's advice here to use a power @@ -1612,17 +1612,17 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, } u[m+n] = u_carry; #if 0 - DEBUG(errs() << "KnuthDiv: normal:"); - DEBUG(for (int i = m+n; i >=0; i--) errs() << " " << u[i]); - DEBUG(errs() << " by"); - DEBUG(for (int i = n; i >0; i--) errs() << " " << v[i-1]); - DEBUG(errs() << '\n'); + DEBUG(dbgs() << "KnuthDiv: normal:"); + DEBUG(for (int i = m+n; i >=0; i--) dbgs() << " " << u[i]); + DEBUG(dbgs() << " by"); + DEBUG(for (int i = n; i >0; i--) dbgs() << " " << v[i-1]); + DEBUG(dbgs() << '\n'); #endif // D2. [Initialize j.] Set j to m. This is the loop counter over the places. int j = m; do { - DEBUG(errs() << "KnuthDiv: quotient digit #" << j << '\n'); + DEBUG(dbgs() << "KnuthDiv: quotient digit #" << j << '\n'); // D3. [Calculate q'.]. // Set qp = (u[j+n]*b + u[j+n-1]) / v[n-1]. (qp=qprime=q') // Set rp = (u[j+n]*b + u[j+n-1]) % v[n-1]. (rp=rprime=r') @@ -1632,7 +1632,7 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, // value qp is one too large, and it eliminates all cases where qp is two // too large. uint64_t dividend = ((uint64_t(u[j+n]) << 32) + u[j+n-1]); - DEBUG(errs() << "KnuthDiv: dividend == " << dividend << '\n'); + DEBUG(dbgs() << "KnuthDiv: dividend == " << dividend << '\n'); uint64_t qp = dividend / v[n-1]; uint64_t rp = dividend % v[n-1]; if (qp == b || qp*v[n-2] > b*rp + u[j+n-2]) { @@ -1641,7 +1641,7 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, if (rp < b && (qp == b || qp*v[n-2] > b*rp + u[j+n-2])) qp--; } - DEBUG(errs() << "KnuthDiv: qp == " << qp << ", rp == " << rp << '\n'); + DEBUG(dbgs() << "KnuthDiv: qp == " << qp << ", rp == " << rp << '\n'); // D4. [Multiply and subtract.] Replace (u[j+n]u[j+n-1]...u[j]) with // (u[j+n]u[j+n-1]..u[j]) - qp * (v[n-1]...v[1]v[0]). This computation @@ -1652,7 +1652,7 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, uint64_t u_tmp = uint64_t(u[j+i]) | (uint64_t(u[j+i+1]) << 32); uint64_t subtrahend = uint64_t(qp) * uint64_t(v[i]); bool borrow = subtrahend > u_tmp; - DEBUG(errs() << "KnuthDiv: u_tmp == " << u_tmp + DEBUG(dbgs() << "KnuthDiv: u_tmp == " << u_tmp << ", subtrahend == " << subtrahend << ", borrow = " << borrow << '\n'); @@ -1666,12 +1666,12 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, k++; } isNeg |= borrow; - DEBUG(errs() << "KnuthDiv: u[j+i] == " << u[j+i] << ", u[j+i+1] == " << + DEBUG(dbgs() << "KnuthDiv: u[j+i] == " << u[j+i] << ", u[j+i+1] == " << u[j+i+1] << '\n'); } - DEBUG(errs() << "KnuthDiv: after subtraction:"); - DEBUG(for (int i = m+n; i >=0; i--) errs() << " " << u[i]); - DEBUG(errs() << '\n'); + DEBUG(dbgs() << "KnuthDiv: after subtraction:"); + DEBUG(for (int i = m+n; i >=0; i--) dbgs() << " " << u[i]); + DEBUG(dbgs() << '\n'); // The digits (u[j+n]...u[j]) should be kept positive; if the result of // this step is actually negative, (u[j+n]...u[j]) should be left as the // true value plus b**(n+1), namely as the b's complement of @@ -1684,9 +1684,9 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, carry = carry && u[i] == 0; } } - DEBUG(errs() << "KnuthDiv: after complement:"); - DEBUG(for (int i = m+n; i >=0; i--) errs() << " " << u[i]); - DEBUG(errs() << '\n'); + DEBUG(dbgs() << "KnuthDiv: after complement:"); + DEBUG(for (int i = m+n; i >=0; i--) dbgs() << " " << u[i]); + DEBUG(dbgs() << '\n'); // D5. [Test remainder.] Set q[j] = qp. If the result of step D4 was // negative, go to step D6; otherwise go on to step D7. @@ -1707,16 +1707,16 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, } u[j+n] += carry; } - DEBUG(errs() << "KnuthDiv: after correction:"); - DEBUG(for (int i = m+n; i >=0; i--) errs() <<" " << u[i]); - DEBUG(errs() << "\nKnuthDiv: digit result = " << q[j] << '\n'); + DEBUG(dbgs() << "KnuthDiv: after correction:"); + DEBUG(for (int i = m+n; i >=0; i--) dbgs() <<" " << u[i]); + DEBUG(dbgs() << "\nKnuthDiv: digit result = " << q[j] << '\n'); // D7. [Loop on j.] Decrease j by one. Now if j >= 0, go back to D3. } while (--j >= 0); - DEBUG(errs() << "KnuthDiv: quotient:"); - DEBUG(for (int i = m; i >=0; i--) errs() <<" " << q[i]); - DEBUG(errs() << '\n'); + DEBUG(dbgs() << "KnuthDiv: quotient:"); + DEBUG(for (int i = m; i >=0; i--) dbgs() <<" " << q[i]); + DEBUG(dbgs() << '\n'); // D8. [Unnormalize]. Now q[...] is the desired quotient, and the desired // remainder may be obtained by dividing u[...] by d. If r is non-null we @@ -1727,22 +1727,22 @@ static void KnuthDiv(unsigned *u, unsigned *v, unsigned *q, unsigned* r, // shift right here. In order to mak if (shift) { unsigned carry = 0; - DEBUG(errs() << "KnuthDiv: remainder:"); + DEBUG(dbgs() << "KnuthDiv: remainder:"); for (int i = n-1; i >= 0; i--) { r[i] = (u[i] >> shift) | carry; carry = u[i] << (32 - shift); - DEBUG(errs() << " " << r[i]); + DEBUG(dbgs() << " " << r[i]); } } else { for (int i = n-1; i >= 0; i--) { r[i] = u[i]; - DEBUG(errs() << " " << r[i]); + DEBUG(dbgs() << " " << r[i]); } } - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); } #if 0 - DEBUG(errs() << '\n'); + DEBUG(dbgs() << '\n'); #endif } @@ -2191,7 +2191,7 @@ void APInt::dump() const { SmallString<40> S, U; this->toStringUnsigned(U); this->toStringSigned(S); - errs() << "APInt(" << BitWidth << "b, " + dbgs() << "APInt(" << BitWidth << "b, " << U.str() << "u " << S.str() << "s)"; } |