define ffzl utility function
This commit is contained in:
1 parent
f08d4d31db
commit
ec78add6ab
2 files changed
+6
-2
No files matched your search
@@ -264,11 +264,11 @@ static size_t get_free_slot(struct random_state *rng, size_t slots, struct slab_
|
||||
// randomize start location for linear search (uniform random choice is too slow)
|
||||
uint64_t random_split = ~0UL >> get_random_size_uniform(rng, slots);
|
||||
|
||||
size_t slot = __builtin_ffsl(~(masked | random_split));
|
||||
size_t slot = ffzl(masked | random_split);
|
||||
if (slot) {
|
||||
return slot - 1;
|
||||
} else {
|
||||
return __builtin_ffsl(~masked) - 1;
|
||||
return ffzl(masked) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user