summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-05-08 23:49:49 +0000
committerCraig Topper <craig.topper@gmail.com>2017-05-08 23:49:49 +0000
commit24ae69515baf096b0fd1efa551f319e440283aed (patch)
treeece5623d7b9e8f2531837dd288854c605301d7d5 /llvm/lib/Support/APInt.cpp
parentf7e8acf0fc6c7031dc312ddc1e83496bdce2b454 (diff)
downloadbcm5719-llvm-24ae69515baf096b0fd1efa551f319e440283aed.tar.gz
bcm5719-llvm-24ae69515baf096b0fd1efa551f319e440283aed.zip
[APInt] Remove 'else' after 'return' in udiv and urem. NFC
llvm-svn: 302486
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index caa0691f920..774fe86f106 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1588,16 +1588,15 @@ APInt APInt::udiv(const APInt& RHS) const {
if (!lhsWords)
// 0 / X ===> 0
return APInt(BitWidth, 0);
- else if (lhsWords < rhsWords || this->ult(RHS)) {
+ if (lhsWords < rhsWords || this->ult(RHS))
// X / Y ===> 0, iff X < Y
return APInt(BitWidth, 0);
- } else if (*this == RHS) {
+ if (*this == RHS)
// X / X ===> 1
return APInt(BitWidth, 1);
- } else if (lhsWords == 1 && rhsWords == 1) {
+ if (lhsWords == 1 && rhsWords == 1)
// All high words are zero, just use native divide
return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]);
- }
// We have to compute it the hard way. Invoke the Knuth divide algorithm.
APInt Quotient(1,0); // to hold result.
@@ -1633,19 +1632,18 @@ APInt APInt::urem(const APInt& RHS) const {
assert(rhsWords && "Performing remainder operation by zero ???");
// Check the degenerate cases
- if (lhsWords == 0) {
+ if (lhsWords == 0)
// 0 % Y ===> 0
return APInt(BitWidth, 0);
- } else if (lhsWords < rhsWords || this->ult(RHS)) {
+ if (lhsWords < rhsWords || this->ult(RHS))
// X % Y ===> X, iff X < Y
return *this;
- } else if (*this == RHS) {
+ if (*this == RHS)
// X % X == 0;
return APInt(BitWidth, 0);
- } else if (lhsWords == 1) {
+ if (lhsWords == 1)
// All high words are zero, just use native remainder
return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]);
- }
// We have to compute it the hard way. Invoke the Knuth divide algorithm.
APInt Remainder(1,0);
OpenPOWER on IntegriCloud