mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 23:22:07 +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
|
@ -6,6 +6,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/BuiltinWrappers.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Random.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
|
@ -303,7 +304,7 @@ JS_DEFINE_NATIVE_FUNCTION(MathObject::clz32)
|
|||
auto number = TRY(vm.argument(0).to_u32(global_object));
|
||||
if (number == 0)
|
||||
return Value(32);
|
||||
return Value(__builtin_clz(number));
|
||||
return Value(count_leading_zeroes(number));
|
||||
}
|
||||
|
||||
// 21.3.2.2 Math.acos ( x ), https://tc39.es/ecma262/#sec-math.acos
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue