kern: on second thought, gcc built ins are for chumps

This commit is contained in:
Michael Scire 2022-03-22 23:10:09 -07:00
parent bb0be4de8e
commit b7091df796

View File

@ -70,7 +70,7 @@ namespace ams::kern {
static constexpr inline u64 ConvertVirtualCoreMaskToPhysical(u64 v_core_mask) { static constexpr inline u64 ConvertVirtualCoreMaskToPhysical(u64 v_core_mask) {
u64 p_core_mask = 0; u64 p_core_mask = 0;
while (v_core_mask != 0) { while (v_core_mask != 0) {
const u64 next = __builtin_ctzll(v_core_mask); const u64 next = util::CountTrailingZeros(v_core_mask);
v_core_mask &= ~(static_cast<u64>(1) << next); v_core_mask &= ~(static_cast<u64>(1) << next);
p_core_mask |= (static_cast<u64>(1) << cpu::VirtualToPhysicalCoreMap[next]); p_core_mask |= (static_cast<u64>(1) << cpu::VirtualToPhysicalCoreMap[next]);
} }