mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:17:34 +00:00
AK: Implement FloatExtractor<f128>
This patch adds support for 128-bit floating points in FloatExtractor. This is required to build SerenityOS on MacOS/aarch64. It might break building for Raspberry Pi.
This commit is contained in:
parent
2e806dab07
commit
1aa07d7328
3 changed files with 39 additions and 1 deletions
|
@ -97,6 +97,24 @@ inline constexpr int count_leading_zeroes(IntType value)
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef __SIZEOF_INT128__
|
||||
// This is required for math.cpp internal_scalbn
|
||||
inline constexpr int count_leading_zeroes(unsigned __int128 value)
|
||||
{
|
||||
# if defined(AK_COMPILER_CLANG) || defined(AK_COMPILER_GCC)
|
||||
return (value > __UINT64_MAX__) ? __builtin_clzll(value >> 64) : 64 + __builtin_clzll(value);
|
||||
# else
|
||||
unsigned __int128 mask = (unsigned __int128)1 << 127;
|
||||
int ret = 0;
|
||||
while ((value & mask) == 0) {
|
||||
++ret;
|
||||
mask >>= 1;
|
||||
}
|
||||
return ret;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
// The function will return the number of leading zeroes in the type. If
|
||||
// the given number is zero, this function will return the number of bits
|
||||
// in the IntType.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue