diff options
Diffstat (limited to 'sysdeps/ieee754')
-rw-r--r-- | sysdeps/ieee754/bits/huge_val.h (renamed from sysdeps/ieee754/huge_val.h) | 13 | ||||
-rw-r--r-- | sysdeps/ieee754/bits/nan.h (renamed from sysdeps/ieee754/nan.h) | 33 |
2 files changed, 23 insertions, 23 deletions
diff --git a/sysdeps/ieee754/huge_val.h b/sysdeps/ieee754/bits/huge_val.h index a2520859e4..fe0144c734 100644 --- a/sysdeps/ieee754/huge_val.h +++ b/sysdeps/ieee754/bits/huge_val.h @@ -18,12 +18,12 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _HUGE_VAL_H -#define _HUGE_VAL_H 1 +#ifndef _MATH_H +#error "Never use <bits/huge_val.h> directly; include <math.h> instead." +#endif + #include <features.h> -#include <sys/cdefs.h> -#include <endian.h> /* IEEE positive infinity (-HUGE_VAL is negative infinity). */ @@ -36,6 +36,9 @@ #else /* not GCC */ +#include <sys/cdefs.h> +#include <endian.h> + typedef union { unsigned char __c[8]; double __d; } __huge_val_t; #if __BYTE_ORDER == __BIG_ENDIAN @@ -84,5 +87,3 @@ static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes }; #define HUGE_VALL HUGE_VAL #endif /* __USE_ISOC9X. */ - -#endif /* huge_val.h */ diff --git a/sysdeps/ieee754/nan.h b/sysdeps/ieee754/bits/nan.h index 499edbac8c..94988ced9c 100644 --- a/sysdeps/ieee754/nan.h +++ b/sysdeps/ieee754/bits/nan.h @@ -17,42 +17,43 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef _NAN_H +#ifndef _MATH_H +# error "Never use <bits/nan.h> directly; include <math.h> instead." +#endif -#define _NAN_H 1 /* IEEE Not A Number. */ #ifdef __GNUC__ -#define NAN \ +# define NAN \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; }) \ { __l: 0x7ff8000000000000ULL }).__d) -#define NANF \ +# define NANF \ (__extension__ \ ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \ { __l: 0x7fc00000UL }).__d) #else -#include <endian.h> +# include <endian.h> -#if __BYTE_ORDER == __BIG_ENDIAN -#define __nan_bytes { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } -#define __nanf_bytes { 0x7f, 0xc0, 0, 0 } -#endif -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } -#define __nanf_bytes { 0, 0, 0xc0, 0x7f } -#endif +# if __BYTE_ORDER == __BIG_ENDIAN +# define __nan_bytes { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } +# define __nanf_bytes { 0x7f, 0xc0, 0, 0 } +# endif +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define __nan_bytes { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } +# define __nanf_bytes { 0, 0, 0xc0, 0x7f } +# endif static union { unsigned char __c[8]; double __d; } __nan = { __nan_bytes }; -#define NAN (__nan.__d) +# define NAN (__nan.__d) static union { unsigned char __c[4]; double __d; } __nanf = { __nanf_bytes }; -#define NANF (__nanf.__d) +# define NANF (__nanf.__d) #endif /* GCC. */ @@ -60,5 +61,3 @@ static union { unsigned char __c[4]; double __d; } __nanf = { __nanf_bytes }; same as `double'. */ #define NANL NAN - -#endif /* nan.h */ |