mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
AK: Define FloatExtractor for long double when it's an alias of double
On some platforms, like macOS on ARM, long double is a different type but has the exact same characteristics as a normal double. When it is the case, define FloatExtractor<long double> as an alias to FloatExtractor<double>.
This commit is contained in:
1 parent
25b914f990
commit
bfa440bbf8
2 files changed
+9
No files matched your search
@@ -87,6 +87,13 @@ struct FloatExtractor<f64> {
|
||||
};
|
||||
static_assert(AssertSize<FloatExtractor<f64>, sizeof(f64)>());
|
||||
|
||||
#ifdef AK_LONG_DOUBLE_IS_DOUBLE
|
||||
template<>
|
||||
struct FloatExtractor<long double> : FloatExtractor<double> {
|
||||
};
|
||||
static_assert(AssertSize<FloatExtractor<long double>, sizeof(FloatExtractor<double>)>());
|
||||
#endif
|
||||
|
||||
template<>
|
||||
struct FloatExtractor<f32> {
|
||||
static constexpr FloatExtractor<f32> from_float(f32 f) { return bit_cast<FloatExtractor<f32>>(f); }
|
||||
|
||||
@@ -30,6 +30,8 @@ using f80 = long double;
|
||||
# elif __LDBL_MANT_DIG__ == 113 && __LDBL_MAX_EXP__ == 16384
|
||||
# define AK_HAS_FLOAT_128 1
|
||||
using f128 = long double;
|
||||
# elif __LDBL_MANT_DIG__ == __DBL_MANT_DIG__ && __LDBL_MAX_EXP__ == __DBL_MAX_EXP__
|
||||
# define AK_LONG_DOUBLE_IS_DOUBLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
Reference in new issue
Block a user