Skip to content

Commit 04cffaa

Browse files
[Support] Simplify CTLog2 (NFC) (#143559)
We can drop kValue > 0 in CTLog2 because llvm::isPowerOf2_64 returns false on input 0.
1 parent 50313a5 commit 04cffaa

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/include/llvm/Support/MathExtras.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ inline bool isShiftedMask_64(uint64_t Value, unsigned &MaskIdx,
328328
/// Compile time Log2.
329329
/// Valid only for positive powers of two.
330330
template <size_t kValue> constexpr size_t CTLog2() {
331-
static_assert(kValue > 0 && llvm::isPowerOf2_64(kValue),
332-
"Value is not a valid power of 2");
331+
static_assert(llvm::isPowerOf2_64(kValue), "Value is not a valid power of 2");
333332
return 1 + CTLog2<kValue / 2>();
334333
}
335334

0 commit comments

Comments
 (0)