diff options
author | Kazu Hirata <kazu@google.com> | 2023-01-28 12:41:19 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2023-01-28 12:41:20 -0800 |
commit | 55e2cd16095d64e9afca6e109e40ed95d735dc7f (patch) | |
tree | c61699df07a76b98d99ed93dfb95d0e003b0956a /llvm/lib/Support/APInt.cpp | |
parent | a536d3e40e088ab725c6d2e6c0b8ca21451b511c (diff) | |
download | llvm-55e2cd16095d64e9afca6e109e40ed95d735dc7f.zip llvm-55e2cd16095d64e9afca6e109e40ed95d735dc7f.tar.gz llvm-55e2cd16095d64e9afca6e109e40ed95d735dc7f.tar.bz2 |
Use llvm::count{lr}_{zero,one} (NFC)
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index bc1c888..dda7747 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -626,7 +626,7 @@ unsigned APInt::countLeadingZerosSlowCase() const { if (V == 0) Count += APINT_BITS_PER_WORD; else { - Count += llvm::countLeadingZeros(V); + Count += llvm::countl_zero(V); break; } } @@ -646,13 +646,13 @@ unsigned APInt::countLeadingOnesSlowCase() const { shift = APINT_BITS_PER_WORD - highWordBits; } int i = getNumWords() - 1; - unsigned Count = llvm::countLeadingOnes(U.pVal[i] << shift); + unsigned Count = llvm::countl_one(U.pVal[i] << shift); if (Count == highWordBits) { for (i--; i >= 0; --i) { if (U.pVal[i] == WORDTYPE_MAX) Count += APINT_BITS_PER_WORD; else { - Count += llvm::countLeadingOnes(U.pVal[i]); + Count += llvm::countl_one(U.pVal[i]); break; } } @@ -666,7 +666,7 @@ unsigned APInt::countTrailingZerosSlowCase() const { for (; i < getNumWords() && U.pVal[i] == 0; ++i) Count += APINT_BITS_PER_WORD; if (i < getNumWords()) - Count += llvm::countTrailingZeros(U.pVal[i]); + Count += llvm::countr_zero(U.pVal[i]); return std::min(Count, BitWidth); } @@ -676,7 +676,7 @@ unsigned APInt::countTrailingOnesSlowCase() const { for (; i < getNumWords() && U.pVal[i] == WORDTYPE_MAX; ++i) Count += APINT_BITS_PER_WORD; if (i < getNumWords()) - Count += llvm::countTrailingOnes(U.pVal[i]); + Count += llvm::countr_one(U.pVal[i]); assert(Count <= BitWidth); return Count; } @@ -1318,7 +1318,7 @@ static void KnuthDiv(uint32_t *u, uint32_t *v, uint32_t *q, uint32_t* r, // and v so that its high bits are shifted to the top of v's range without // overflow. Note that this can require an extra word in u so that u must // be of length m+n+1. - unsigned shift = countLeadingZeros(v[n-1]); + unsigned shift = llvm::countl_zero(v[n - 1]); uint32_t v_carry = 0; uint32_t u_carry = 0; if (shift) { |