From 435a9b83a1860319e0e00555424541151f0f0e85 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 9 Jun 2025 12:32:34 -0700 Subject: [PATCH] [Support] Simplify CTLog2 (NFC) We can drop kValue > 0 in CTLog2 because llvm::isPowerOf2_64 returns false on input 0. --- llvm/include/llvm/Support/MathExtras.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index 246080aa45ce0..ae3150e5602ee 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -328,8 +328,7 @@ inline bool isShiftedMask_64(uint64_t Value, unsigned &MaskIdx, /// Compile time Log2. /// Valid only for positive powers of two. template constexpr size_t CTLog2() { - static_assert(kValue > 0 && llvm::isPowerOf2_64(kValue), - "Value is not a valid power of 2"); + static_assert(llvm::isPowerOf2_64(kValue), "Value is not a valid power of 2"); return 1 + CTLog2(); }