From: Kazu Hirata Date: Sun, 22 Jan 2023 22:34:43 +0000 (-0800) Subject: [Support] Use llvm::bit_floor in PowerOf2Floor (NFC) X-Git-Tag: upstream/17.0.6~20058 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32ce06bbf2cf0392fd5f3d147b6640f76f864230;p=platform%2Fupstream%2Fllvm.git [Support] Use llvm::bit_floor in PowerOf2Floor (NFC) --- diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h index b2b2721..ff136ba 100644 --- a/llvm/include/llvm/Support/MathExtras.h +++ b/llvm/include/llvm/Support/MathExtras.h @@ -483,8 +483,7 @@ constexpr inline uint64_t NextPowerOf2(uint64_t A) { /// Returns the power of two which is less than or equal to the given value. /// Essentially, it is a floor operation across the domain of powers of two. inline uint64_t PowerOf2Floor(uint64_t A) { - if (!A) return 0; - return 1ull << (63 - llvm::countl_zero(A)); + return llvm::bit_floor(A); } /// Returns the power of two which is greater than or equal to the given value.