mirror of
https://github.com/RGBCube/serenity
synced 2025-05-23 18:25:08 +00:00
AK+Everywhere: Replace __builtin bit functions
In order to reduce our reliance on __builtin_{ffs, clz, ctz, popcount}, this commit removes all calls to these functions and replaces them with the equivalent functions in AK/BuiltinWrappers.h.
This commit is contained in:
parent
26bb3e1acf
commit
08e4a1a4dc
20 changed files with 108 additions and 115 deletions
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/BuiltinWrappers.h>
|
||||
#include <AK/ScopeGuard.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <AK/Time.h>
|
||||
|
@ -77,7 +78,7 @@ Thread& Scheduler::pull_next_runnable_thread()
|
|||
return g_ready_queues->with([&](auto& ready_queues) -> Thread& {
|
||||
auto priority_mask = ready_queues.mask;
|
||||
while (priority_mask != 0) {
|
||||
auto priority = __builtin_ffsl(priority_mask);
|
||||
auto priority = bit_scan_forward(priority_mask);
|
||||
VERIFY(priority > 0);
|
||||
auto& ready_queue = ready_queues.queues[--priority];
|
||||
for (auto& thread : ready_queue.thread_list) {
|
||||
|
@ -116,7 +117,7 @@ Thread* Scheduler::peek_next_runnable_thread()
|
|||
return g_ready_queues->with([&](auto& ready_queues) -> Thread* {
|
||||
auto priority_mask = ready_queues.mask;
|
||||
while (priority_mask != 0) {
|
||||
auto priority = __builtin_ffsl(priority_mask);
|
||||
auto priority = bit_scan_forward(priority_mask);
|
||||
VERIFY(priority > 0);
|
||||
auto& ready_queue = ready_queues.queues[--priority];
|
||||
for (auto& thread : ready_queue.thread_list) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue