From af5f6d9556441487e5c66a7a4cfeddf4ed354aa7 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Mon, 2 Sep 2013 00:38:51 +0000 Subject: long double cleanup, initial commit new ldshape union, ld128 support is kept, code that used the old ldshape union was rewritten (IEEEl2bits union of freebsd libm is not touched yet) ld80 __fpclassifyl no longer tries to handle invalid representation --- src/internal/libm.h | 28 ++++++++++++++++++++++++++++ src/internal/longdbl.h | 26 -------------------------- 2 files changed, 28 insertions(+), 26 deletions(-) (limited to 'src/internal') diff --git a/src/internal/libm.h b/src/internal/libm.h index 64cc8388..52ac61ec 100644 --- a/src/internal/libm.h +++ b/src/internal/libm.h @@ -17,6 +17,7 @@ #include #include #include +#include #include "longdbl.h" @@ -32,6 +33,33 @@ union dshape { uint64_t bits; }; +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN +union ldshape { + long double f; + struct { + uint64_t m; + uint16_t se; + } i; +}; +#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN +union ldshape { + long double f; + struct { + uint64_t lo; + uint32_t mid; + uint16_t top; + uint16_t se; + } i; + struct { + uint64_t lo; + uint64_t hi; + } i2; +}; +#else +#error Unsupported long double representation +#endif + #define FORCE_EVAL(x) do { \ if (sizeof(x) == sizeof(float)) { \ volatile float __x; \ diff --git a/src/internal/longdbl.h b/src/internal/longdbl.h index 25ec8021..e93fb4ff 100644 --- a/src/internal/longdbl.h +++ b/src/internal/longdbl.h @@ -4,32 +4,6 @@ #include #include -#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 -#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 -union ldshape { - long double value; - struct { - uint64_t m; - uint16_t exp:15; - uint16_t sign:1; - uint16_t pad; - } bits; -}; -#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 -union ldshape { - long double value; - struct { - uint64_t mlo; - uint64_t mhi:48; - uint16_t exp:15; - uint16_t sign:1; - } bits; -}; -#else -#error Unsupported long double representation -#endif - - // FIXME: hacks to make freebsd+openbsd long double code happy // union and macros for freebsd -- cgit v1.2.1