OSDN Git Service

Replace FSF snail mail address with URLs
[uclinux-h8/uClibc.git] / libc / sysdeps / linux / arm / bits / fenv.h
1 /* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <http://www.gnu.org/licenses/>.  */
17
18 #ifndef _FENV_H
19 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
20 #endif
21
22 #ifdef __MAVERICK__
23
24 /* Define bits representing exceptions in the FPU status word.  */
25 enum
26   {
27     FE_INVALID = 1,
28 #define FE_INVALID FE_INVALID
29     FE_OVERFLOW = 4,
30 #define FE_OVERFLOW FE_OVERFLOW
31     FE_UNDERFLOW = 8,
32 #define FE_UNDERFLOW FE_UNDERFLOW
33     FE_INEXACT = 16,
34 #define FE_INEXACT FE_INEXACT
35   };
36
37 /* Amount to shift by to convert an exception to a mask bit.  */
38 #define FE_EXCEPT_SHIFT    5
39
40 /* All supported exceptions.  */
41 #define FE_ALL_EXCEPT  \
42         (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
43
44 /* IEEE rounding modes.  */
45 enum
46   {
47     FE_TONEAREST = 0,
48 #define FE_TONEAREST    FE_TONEAREST
49     FE_TOWARDZERO = 0x400,
50 #define FE_TOWARDZERO   FE_TOWARDZERO
51     FE_DOWNWARD = 0x800,
52 #define FE_DOWNWARD     FE_DOWNWARD
53     FE_UPWARD = 0xc00,
54 #define FE_UPWARD       FE_UPWARD
55   };
56
57 #define FE_ROUND_MASK (FE_UPWARD)
58
59 #else /* !__MAVERICK__ */
60
61 /* Define bits representing exceptions in the FPU status word.  */
62 enum
63   {
64     FE_INVALID = 1,
65 #define FE_INVALID FE_INVALID
66     FE_DIVBYZERO = 2,
67 #define FE_DIVBYZERO FE_DIVBYZERO
68     FE_OVERFLOW = 4,
69 #define FE_OVERFLOW FE_OVERFLOW
70     FE_UNDERFLOW = 8,
71 #define FE_UNDERFLOW FE_UNDERFLOW
72   };
73
74 /* Amount to shift by to convert an exception to a mask bit.  */
75 #define FE_EXCEPT_SHIFT 16
76
77 /* All supported exceptions.  */
78 #define FE_ALL_EXCEPT   \
79         (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW)
80
81 /* The ARM FPU basically only supports round-to-nearest.  Other rounding
82    modes exist, but you have to encode them in the actual instruction.  */
83 #define FE_TONEAREST    0
84
85 #endif /* __MAVERICK__ */
86
87 /* Type representing exception flags. */
88 typedef unsigned long int fexcept_t;
89
90 /* Type representing floating-point environment.  */
91 typedef struct
92   {
93     unsigned long int __cw;
94   }
95 fenv_t;
96
97 /* If the default argument is used we use this value.  */
98 #define FE_DFL_ENV      ((fenv_t *) -1l)