Userspace: Use BAN::Math instead of builtins

This commit is contained in:
2026-08-22 14:45:23 +03:00
parent ae24fb1dd0
commit 645b6d772d
2 changed files with 5 additions and 7 deletions
+2 -4
View File
@@ -96,8 +96,6 @@ struct BitmapAllocator
// NOTE: We could optimize other bitmap functions than this
// but this one is the bottle neck so it doesn't matter
static_assert(sizeof(unsigned long long) == sizeof(uint64_t));
if (index >= total_chunks)
return index;
@@ -105,7 +103,7 @@ struct BitmapAllocator
{
const uint64_t qword = *reinterpret_cast<const uint64_t*>(base + (index - rem) / 8) >> rem;
if (qword != UINT64_MAX >> rem)
return index + __builtin_ctzll(~qword);
return index + BAN::Math::ctz(~qword);
index += 64 - rem;
}
@@ -113,7 +111,7 @@ struct BitmapAllocator
{
const uint64_t qword = *reinterpret_cast<const uint64_t*>(base + index / 8);
if (qword != UINT64_MAX)
return index + __builtin_ctzll(~qword);
return index + BAN::Math::ctz(~qword);
index += 64;
}