From 9dce65ed0e78f9afefb8f82d391ba06a5d9ad9ca Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Wed, 23 Sep 2026 08:15:38 +0200 Subject: [PATCH] Use trailing-zero builtin with older libc++ --- Sources/OpenAttributeGraphCxx/Data/table.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/OpenAttributeGraphCxx/Data/table.cpp b/Sources/OpenAttributeGraphCxx/Data/table.cpp index 1d103bd0..3b999640 100644 --- a/Sources/OpenAttributeGraphCxx/Data/table.cpp +++ b/Sources/OpenAttributeGraphCxx/Data/table.cpp @@ -145,7 +145,9 @@ ptr 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(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;