From 6e261a107cf92a62817e81c78b52470d81218e4a Mon Sep 17 00:00:00 2001 From: "Avi Halachmi (:avih)" Date: Fri, 6 Nov 2015 04:14:10 +0200 Subject: [PATCH] win: math.h: isnan: use macro, similar to others (still broken) It was broken due to tcc not able to compile asm with 't' constraint, and it's still broken because fpclassify on which it now depends has the same issue. Next commit will fix this. --- win32/include/math.h | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/win32/include/math.h b/win32/include/math.h index 251d3f7..d923f17 100644 --- a/win32/include/math.h +++ b/win32/include/math.h @@ -333,38 +333,7 @@ extern "C" { /* 7.12.3.4 */ /* We don't need to worry about trucation here: A NaN stays a NaN. */ - - __CRT_INLINE int __cdecl __isnan (double _x) - { - unsigned short sw; - __asm__ ("fxam;" - "fstsw %%ax": "=a" (sw) : "t" (_x)); - return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) - == FP_NAN; - } - - __CRT_INLINE int __cdecl __isnanf (float _x) - { - unsigned short sw; - __asm__ ("fxam;" - "fstsw %%ax": "=a" (sw) : "t" (_x)); - return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) - == FP_NAN; - } - - __CRT_INLINE int __cdecl __isnanl (long double _x) - { - unsigned short sw; - __asm__ ("fxam;" - "fstsw %%ax": "=a" (sw) : "t" (_x)); - return (sw & (FP_NAN | FP_NORMAL | FP_INFINITE | FP_ZERO | FP_SUBNORMAL)) - == FP_NAN; - } - - -#define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) \ - : sizeof (x) == sizeof (double) ? __isnan (x) \ - : __isnanl (x)) +#define isnan(x) (fpclassify(x) == FP_NAN) /* 7.12.3.5 */ #define isnormal(x) (fpclassify(x) == FP_NORMAL)