Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/OpenAttributeGraphCxx/Data/table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ ptr<page> table::alloc_page(zone *zone, uint32_t needed_size) OAG_NOEXCEPT {
page_map_type free_pages_map = _page_maps[map_index].flip();
while (free_pages_map.any()) {

int candidate_bit = std::countr_zero(static_cast<uint64_t>(free_pages_map.to_ullong()));
// The loop guarantees a nonzero map; the builtin works with
// libc++ versions that predate std::countr_zero.
int candidate_bit = __builtin_ctzll(free_pages_map.to_ullong());

// scan ahead to find enough consecutive free pages
bool found = false;
Expand Down