From: Benjamin Kramer Date: Sat, 1 Jun 2013 11:26:39 +0000 (+0000) Subject: APInt: Simplify code. No functionality change. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=8e851920c0dc16d10db3c4330152a27787aba785;p=oota-llvm.git APInt: Simplify code. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183073 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 108675d1e9a..89f96bd5774 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -2304,24 +2304,7 @@ namespace { static unsigned int partMSB(integerPart value) { - unsigned int n, msb; - - if (value == 0) - return -1U; - - n = integerPartWidth / 2; - - msb = 0; - do { - if (value >> n) { - value >>= n; - msb += n; - } - - n >>= 1; - } while (n); - - return msb; + return findLastSet(value, ZB_Max); } /* Returns the bit number of the least significant set bit of a @@ -2329,24 +2312,7 @@ namespace { static unsigned int partLSB(integerPart value) { - unsigned int n, lsb; - - if (value == 0) - return -1U; - - lsb = integerPartWidth - 1; - n = integerPartWidth / 2; - - do { - if (value << n) { - value <<= n; - lsb -= n; - } - - n >>= 1; - } while (n); - - return lsb; + return findFirstSet(value, ZB_Max); } }