vfs: check userland buffers before reading them.
[haiku.git] / src / system / libroot / posix / glibc / include / arch / m68k / bits / huge_val.h
blobad5253429f4ed85e710d558220f33fdb85e3ec30
1 /* `HUGE_VAL' constants for m68k (where it is infinity).
2 Used by <stdlib.h> and <math.h> functions for overflow.
3 Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #ifndef _MATH_H
22 # error "Never use <bits/huge_val.h> directly; include <math.h> instead."
23 #endif
26 #include <features.h>
27 #include <sys/cdefs.h>
29 /* IEEE positive infinity (-HUGE_VAL is negative infinity). */
31 #ifdef __GNUC__
33 # if __GNUC_PREREQ(2,96)
35 # define HUGE_VAL (__extension__ 0x1.0p2047)
37 # else
39 # define HUGE_VAL \
40 (__extension__ \
41 ((union { unsigned long long __l; double __d; }) \
42 { __l: 0x7ff0000000000000ULL }).__d)
44 # endif
46 #else /* not GCC */
48 static union { unsigned char __c[8]; double __d; } __huge_val =
49 { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
50 # define HUGE_VAL (__huge_val.__d)
52 #endif /* GCC. */
55 /* ISO C 99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
57 #ifdef __USE_ISOC99
59 # if __GNUC_PREREQ(2,96)
61 # define HUGE_VALF (__extension__ 0x1.0p255f)
62 # define HUGE_VALL (__extension__ 0x1.0p32767L)
64 # else
66 # ifdef __GNUC__
68 # define HUGE_VALF \
69 (__extension__ \
70 ((union { unsigned long __l; float __f; }) \
71 { __l: 0x7f800000UL }).__f)
73 # define HUGE_VALL \
74 (__extension__ \
75 ((union { unsigned long __l[3]; long double __ld; }) \
76 { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
78 # else /* not GCC */
80 static union { unsigned char __c[4]; float __f; } __huge_valf =
81 { { 0x7f, 0x80, 0, 0 } };
82 # define HUGE_VALF (__huge_valf.__f)
84 static union { unsigned char __c[12]; long double __ld; } __huge_vall =
85 { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
86 # define HUGE_VALL (__huge_vall.__ld)
88 # endif /* GCC. */
90 # endif /* GCC 2.95. */
92 #endif /* __USE_ISOC99. */