projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e599094
)
[Support] Use llvm::bit_floor in PowerOf2Floor (NFC)
author
Kazu Hirata
<kazu@google.com>
Sun, 22 Jan 2023 22:34:43 +0000
(14:34 -0800)
committer
Kazu Hirata
<kazu@google.com>
Sun, 22 Jan 2023 22:34:43 +0000
(14:34 -0800)
llvm/include/llvm/Support/MathExtras.h
patch
|
blob
|
history
diff --git
a/llvm/include/llvm/Support/MathExtras.h
b/llvm/include/llvm/Support/MathExtras.h
index
b2b2721
..
ff136ba
100644
(file)
--- 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.