master
1/**
2 * This file is part of the mingw-w64 runtime package.
3 * No warranty is given; refer to the file DISCLAIMER within this package.
4 */
5#define __CRT__NO_INLINE
6#include <math.h>
7
8int __fpclassifyl (long double _x){
9#if __SIZEOF_LONG_DOUBLE__ == __SIZEOF_DOUBLE__
10 return __fpclassify(_x);
11#elif defined(_AMD64_) || defined(__x86_64__)
12 __mingw_ldbl_type_t hlp;
13 unsigned int e;
14 hlp.x = _x;
15 e = hlp.lh.sign_exponent & 0x7fff;
16 if (!e)
17 {
18 unsigned int h = hlp.lh.high;
19 if (!(hlp.lh.low | h))
20 return FP_ZERO;
21 else if (!(h & 0x80000000))
22 return FP_SUBNORMAL;
23 }
24 else if (e == 0x7fff)
25 return (((hlp.lh.high & 0x7fffffff) | hlp.lh.low) == 0 ?
26 FP_INFINITE : FP_NAN);
27 return FP_NORMAL;
28#elif defined(__i386__) || defined(_X86_)
29 unsigned short sw;
30 __asm__ __volatile__ (
31 "fxam; fstsw %%ax;"
32 : "=a" (sw)
33 : "t" (_x)
34 );
35 return sw & (FP_NAN | FP_NORMAL | FP_ZERO );
36#endif
37}