1
0
mirror of https://git.code.sf.net/p/mingw-w64/mingw-w64 synced 2025-04-18 17:44:18 +03:00

crt: Use headers: Use __SIZEOF_LONG_DOUBLE__ instead of arch checks in some math functions.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
Jacek Caban 2025-04-03 15:21:09 +02:00
parent 75ed7d2d1f
commit dbb60ad07c
7 changed files with 14 additions and 14 deletions

View File

@ -66,7 +66,7 @@ extern double __QNAN;
#endif
/*long double*/
#if defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
#define MAXNUML 1.7976931348623158E308
#define MAXLOGL 7.09782712893383996843E2
#define MINLOGL -7.08396418532264106224E2
@ -84,7 +84,7 @@ extern double __QNAN;
#define PIL 3.1415926535897932384626L
#define PIO2L 1.5707963267948966192313L
#define PIO4L 7.8539816339744830961566E-1L
#endif /* defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) */
#endif /* __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__ */
#define isfinitel isfinite
#define isinfl isinf

View File

@ -5,7 +5,7 @@
*/
long double fmal(long double x, long double y, long double z);
#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
double fma(double x, double y, double z);

View File

@ -6,7 +6,9 @@
#include <math.h>
int __fpclassifyl (long double _x){
#if defined(__x86_64__) || defined(_AMD64_)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
return __fpclassify(_x);
#elif defined(_AMD64_) || defined(__x86_64__)
__mingw_ldbl_type_t hlp;
unsigned int e;
hlp.x = _x;
@ -23,8 +25,6 @@ int __fpclassifyl (long double _x){
return (((hlp.lh.high & 0x7fffffff) | hlp.lh.low) == 0 ?
FP_INFINITE : FP_NAN);
return FP_NORMAL;
#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
return __fpclassify(_x);
#elif defined(__i386__) || defined(_X86_)
unsigned short sw;
__asm__ __volatile__ (

View File

@ -5,7 +5,7 @@
*/
long double frexpl(long double value, int* exp);
#if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
double frexp(double value, int* exp);

View File

@ -8,10 +8,10 @@
long lrintl (long double x)
{
long retval = 0l;
#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
retval = lrint(x);
#elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("fistpl %0" : "=m" (retval) : "t" (x) : "st");
#endif
return retval;
}

View File

@ -7,10 +7,10 @@
long double rintl (long double x) {
long double retval = 0.0L;
#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x));
#elif defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
retval = rint(x);
#elif defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__)
__asm__ __volatile__ ("frndint;": "=t" (retval) : "0" (x));
#endif
return retval;
}

View File

@ -16,7 +16,7 @@ typedef union __mingw_dbl_type_t {
int __signbit (double x)
{
#if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_)
#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
__mingw_dbl_type_t hlp;
hlp.x = x;