More __builtin_clz to std::countl_zero
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "ConflictSet.h"
|
||||
|
||||
#include <bit>
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
@@ -83,7 +84,7 @@ constexpr inline int align_up(uint32_t unaligned, uint32_t align) {
|
||||
|
||||
/// Returns the smallest power of two >= x
|
||||
[[maybe_unused]] constexpr inline uint32_t nextPowerOfTwo(uint32_t x) {
|
||||
return x <= 1 ? 1 : 1 << (32 - __builtin_clz(x - 1));
|
||||
return x <= 1 ? 1 : 1 << (32 - std::countl_zero(x - 1));
|
||||
}
|
||||
|
||||
struct Arena::ArenaImpl {
|
||||
@@ -277,7 +278,7 @@ inline uint32_t Arbitrary::bounded(uint32_t s) {
|
||||
if (s == 1) {
|
||||
return 0;
|
||||
}
|
||||
switch (32 - __builtin_clz(s - 1)) {
|
||||
switch (32 - std::countl_zero(s - 1)) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
Reference in New Issue
Block a user