From a356d9044535aeb51676536a7358cb5ac3b430d5 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Mon, 4 Nov 2024 10:51:31 +0200 Subject: [PATCH] LibC: Fix libc compilation for 32 bit target --- userspace/libraries/LibC/math.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/userspace/libraries/LibC/math.cpp b/userspace/libraries/LibC/math.cpp index ffec681287..67b7537ca1 100644 --- a/userspace/libraries/LibC/math.cpp +++ b/userspace/libraries/LibC/math.cpp @@ -48,23 +48,10 @@ double func(double a, type b) { return __VA_ARGS__; } \ long double func##l(long double a, type b) { return __VA_ARGS__; } -template -struct integral_atleast; - -template requires(sizeof(T) <= sizeof(uint8_t)) -struct integral_atleast { using type = uint8_t; }; - -template requires(sizeof(T) > sizeof(uint8_t) && sizeof(T) <= sizeof(uint16_t)) -struct integral_atleast { using type = uint16_t; }; - -template requires(sizeof(T) > sizeof(uint16_t) && sizeof(T) <= sizeof(uint32_t)) -struct integral_atleast { using type = uint32_t; }; - -template requires(sizeof(T) > sizeof(uint32_t) && sizeof(T) <= sizeof(uint64_t)) -struct integral_atleast { using type = uint64_t; }; - -template requires(sizeof(T) > sizeof(uint64_t) && sizeof(T) <= sizeof(__uint128_t)) -struct integral_atleast { using type = __uint128_t; }; +template struct float_underlying; +template<> struct float_underlying { using type = uint32_t; }; +template<> struct float_underlying { using type = uint64_t; }; +template<> struct float_underlying { using type = uint64_t; }; template struct __FloatDecompose; @@ -89,7 +76,7 @@ struct __FloatDecompose template struct FloatDecompose { - using value_type = integral_atleast::type; + using value_type = float_underlying::type; static constexpr size_t mantissa_bits = BAN::is_same_v ? FLT_MANT_DIG - 1