mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09: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
Notes:
sideshowbarker
2024-07-17 06:40:35 +09:00
Author: https://github.com/rusitschka
Commit: 1aa07d7328
Pull-request: https://github.com/SerenityOS/serenity/pull/16187
Reviewed-by: https://github.com/nico ✅
3 changed files with 39 additions and 1 deletions
|
@ -15,6 +15,26 @@ namespace AK {
|
|||
template<typename T>
|
||||
union FloatExtractor;
|
||||
|
||||
#ifdef AK_HAS_FLOAT_128
|
||||
template<>
|
||||
union FloatExtractor<f128> {
|
||||
static constexpr int mantissa_bits = 112;
|
||||
static constexpr unsigned __int128 mantissa_max = (((unsigned __int128)1) << 112) - 1;
|
||||
static constexpr int exponent_bias = 16383;
|
||||
static constexpr int exponent_bits = 15;
|
||||
static constexpr unsigned exponent_max = 32767;
|
||||
struct {
|
||||
unsigned __int128 mantissa : 112;
|
||||
unsigned exponent : 15;
|
||||
unsigned sign : 1;
|
||||
};
|
||||
f128 d;
|
||||
};
|
||||
// Validate that f128 and the FloatExtractor union are 128 bits.
|
||||
static_assert(sizeof(f128) == 16);
|
||||
static_assert(sizeof(FloatExtractor<f128>) == 16);
|
||||
#endif
|
||||
|
||||
#ifdef AK_HAS_FLOAT_80
|
||||
template<>
|
||||
union FloatExtractor<f80> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue