| 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | #define __FP_SIGNBIT 0x0200 |
| 7 | int __signbitf (float x); |
| 8 | |
| 9 | typedef union __mingw_flt_type_t { |
| 10 | float x; |
| 11 | unsigned int val; |
| 12 | } __mingw_flt_type_t; |
| 13 | |
| 14 | int __signbitf (float x) |
| 15 | { |
| 16 | #if defined(__x86_64__) || defined(_AMD64_) || defined(__arm__) || defined(_ARM_) || defined(__aarch64__) || defined(_ARM64_) |
| 17 | __mingw_flt_type_t hlp; |
| 18 | hlp.x = x; |
| 19 | return ((hlp.val & 0x80000000) != 0); |
| 20 | #elif defined(__i386__) || defined(_X86_) |
| 21 | unsigned short sw; |
| 22 | __asm__ __volatile__ ("fxam; fstsw %%ax;" |
| 23 | 	 : "=a" (sw) |
| 24 | 	 : "t" (x) ); |
| 25 | return (sw & __FP_SIGNBIT) != 0; |
| 26 | #endif |
| 27 | } |
| 28 | int __attribute__ ((alias ("__signbitf"))) signbitf (float); |