]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix: replace x86 bsf asm in scheduler with portable __builtin_ctz
authorTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 04:50:27 +0000 (01:50 -0300)
committerTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 04:50:27 +0000 (01:50 -0300)
commit37d98f1fdee169827b168ec01ea84c3c9185d8d3
tree45b88b69c25d782641ef7f78268d53bba7a80124
parentc68ce1577fc4101613b3c36a1958d1c216c09175
fix: replace x86 bsf asm in scheduler with portable __builtin_ctz

bsf32() used x86-only 'bsf' inline assembly to find the lowest
set bit in the O(1) scheduler bitmap. This would not compile on
ARM/RISC-V/MIPS. Replace with __builtin_ctz() which GCC supports
on all target architectures.

Passes: make, cppcheck, QEMU smoke test.
src/kernel/scheduler.c