Move all files into ports/ subdirectory in preparation for merge with glibc
[glibc.git] / ports / sysdeps / arm / bits / fenv.h
blob006ccf528892fd2f6d86abb28d0e61e23f6f4f66
1 /* Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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/>. */
18 #ifndef _FENV_H
19 # error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
20 #endif
22 /* Define bits representing exceptions in the FPU status word. */
23 enum
25 FE_INVALID = 1,
26 #define FE_INVALID FE_INVALID
27 FE_DIVBYZERO = 2,
28 #define FE_DIVBYZERO FE_DIVBYZERO
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
37 /* Amount to shift by to convert an exception to a mask bit. */
38 #define FE_EXCEPT_SHIFT 8
40 /* All supported exceptions. */
41 #define FE_ALL_EXCEPT \
42 (FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
44 /* VFP supports all of the four defined rounding modes. */
45 enum
47 FE_TONEAREST = 0,
48 #define FE_TONEAREST FE_TONEAREST
49 FE_UPWARD = 0x400000,
50 #define FE_UPWARD FE_UPWARD
51 FE_DOWNWARD = 0x800000,
52 #define FE_DOWNWARD FE_DOWNWARD
53 FE_TOWARDZERO = 0xc00000
54 #define FE_TOWARDZERO FE_TOWARDZERO
57 /* Type representing exception flags. */
58 typedef unsigned int fexcept_t;
60 /* Type representing floating-point environment. */
61 typedef struct
63 unsigned int __cw;
65 fenv_t;
67 /* If the default argument is used we use this value. */
68 #define FE_DFL_ENV ((fenv_t *) -1l)
70 #ifdef __USE_GNU
71 /* Floating-point environment where none of the exceptions are masked. */
72 # define FE_NOMASK_ENV ((const fenv_t *) -2)
73 #endif