diff options
author | Nick Johnson <sylvyrfysh@gmail.com> | 2021-12-19 15:46:55 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-21 22:13:51 +0100 |
commit | 08e4a1a4dcbf07853f3c1a63adb64298fc236e3f (patch) | |
tree | 96b88d0dd878850c1e9cb7313a28f26964435536 /Kernel/Storage | |
parent | 26bb3e1acf4aa1814573d628af356f9fbb628786 (diff) | |
download | serenity-08e4a1a4dcbf07853f3c1a63adb64298fc236e3f.zip |
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.
Diffstat (limited to 'Kernel/Storage')
-rw-r--r-- | Kernel/Storage/ATA/AHCIController.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Storage/ATA/AHCIController.cpp b/Kernel/Storage/ATA/AHCIController.cpp index 1524fbfa1c..6d5aa9d8c6 100644 --- a/Kernel/Storage/ATA/AHCIController.cpp +++ b/Kernel/Storage/ATA/AHCIController.cpp @@ -5,6 +5,7 @@ */ #include <AK/Atomic.h> +#include <AK/BuiltinWrappers.h> #include <AK/OwnPtr.h> #include <AK/RefPtr.h> #include <AK/Types.h> @@ -185,12 +186,12 @@ RefPtr<StorageDevice> AHCIController::device(u32 index) const { NonnullRefPtrVector<StorageDevice> connected_devices; u32 pi = hba().control_regs.pi; - u32 bit = __builtin_ffsl(pi); + u32 bit = bit_scan_forward(pi); while (bit) { dbgln_if(AHCI_DEBUG, "Checking implemented port {}, pi {:b}", bit - 1, pi); pi &= ~(1u << (bit - 1)); auto checked_device = device_by_port(bit - 1); - bit = __builtin_ffsl(pi); + bit = bit_scan_forward(pi); if (checked_device.is_null()) continue; connected_devices.append(checked_device.release_nonnull()); |