summaryrefslogtreecommitdiff
path: root/Kernel/Storage
diff options
context:
space:
mode:
authorNick Johnson <sylvyrfysh@gmail.com>2021-12-19 15:46:55 -0600
committerAndreas Kling <kling@serenityos.org>2021-12-21 22:13:51 +0100
commit08e4a1a4dcbf07853f3c1a63adb64298fc236e3f (patch)
tree96b88d0dd878850c1e9cb7313a28f26964435536 /Kernel/Storage
parent26bb3e1acf4aa1814573d628af356f9fbb628786 (diff)
downloadserenity-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.cpp5
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());