Implement isOneBitSet in terms of APInt::countPopulation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35186 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2007-03-19 21:04:43 +00:00
parent 5a1e3e1a7d
commit 44e33e674a

View File

@ -3474,8 +3474,7 @@ static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) {
// isOneBitSet - Return true if there is exactly one bit set in the specified
// constant.
static bool isOneBitSet(const ConstantInt *CI) {
uint64_t V = CI->getZExtValue();
return V && (V & (V-1)) == 0;
return CI->getValue().countPopulation() == 1;
}
#if 0 // Currently unused