summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC
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 /Userland/Libraries/LibC
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 'Userland/Libraries/LibC')
-rw-r--r--Userland/Libraries/LibC/malloc.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibC/malloc.cpp b/Userland/Libraries/LibC/malloc.cpp
index e4268fb76c..bdaf8b1f53 100644
--- a/Userland/Libraries/LibC/malloc.cpp
+++ b/Userland/Libraries/LibC/malloc.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <AK/BuiltinWrappers.h>
#include <AK/Debug.h>
#include <AK/ScopedValueRollback.h>
#include <AK/Vector.h>
@@ -437,7 +438,7 @@ void* malloc(size_t size)
// _aligned_free(), so it can be easily implemented on top of malloc().
void* _aligned_malloc(size_t size, size_t alignment)
{
- if (__builtin_popcount(alignment) != 1) {
+ if (popcount(alignment) != 1) {
errno = EINVAL;
return nullptr;
}