]> 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)
commit0aafb45b937672327c6dcacf96cb3abb27743924
tree829ff7910210f29cfc0a0c26c85a5ac81e78cb00
parentd30086ed099f134544f9a1df001ee037aa452515
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