ReactOS 0.4.15-dev-8093-g3285f69
fenv.h
Go to the documentation of this file.
1
6#ifndef _FENV_H_
7#define _FENV_H_
8
9/* FPU status word exception flags */
10#define FE_INVALID 0x01
11#define FE_DENORMAL 0x02
12#define FE_DIVBYZERO 0x04
13#define FE_OVERFLOW 0x08
14#define FE_UNDERFLOW 0x10
15#define FE_INEXACT 0x20
16#define FE_ALL_EXCEPT (FE_INVALID | FE_DENORMAL | FE_DIVBYZERO \
17 | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT)
18
19/* FPU control word rounding flags */
20#define FE_TONEAREST 0x0000
21#define FE_DOWNWARD 0x0400
22#define FE_UPWARD 0x0800
23#define FE_TOWARDZERO 0x0c00
24
25/* The MXCSR exception flags are the same as the
26 FE flags. */
27#define __MXCSR_EXCEPT_FLAG_SHIFT 0
28
29/* How much to shift FE status word exception flags
30 to get MXCSR rounding flags, */
31#define __MXCSR_ROUND_FLAG_SHIFT 3
32
33#ifndef RC_INVOKED
34/*
35 For now, support only for the basic abstraction of flags that are
36 either set or clear. fexcept_t could be structure that holds more
37 info about the fp environment.
38*/
39typedef unsigned short fexcept_t;
40
41/* This 32-byte struct represents the entire floating point
42 environment as stored by fnstenv or fstenv, augmented by
43 the contents of the MXCSR register, as stored by stmxcsr
44 (if CPU supports it). */
45typedef struct
46{
47 unsigned short __control_word;
48 unsigned short __unused0;
49 unsigned short __status_word;
50 unsigned short __unused1;
51 unsigned short __tag_word;
52 unsigned short __unused2;
53 unsigned int __ip_offset; /* instruction pointer offset */
54 unsigned short __ip_selector;
55 unsigned short __opcode;
56 unsigned int __data_offset;
57 unsigned short __data_selector;
58 unsigned short __unused3;
59 unsigned int __mxcsr; /* contents of the MXCSR register */
60} fenv_t;
61
62
63/*The C99 standard (7.6.9) allows us to define implementation-specific macros for
64 different fp environments */
65
66/* The default Intel x87 floating point environment (64-bit mantissa) */
67#define FE_PC64_ENV ((const fenv_t *)-1)
68
69/* The floating point environment set by MSVCRT _fpreset (53-bit mantissa) */
70#define FE_PC53_ENV ((const fenv_t *)-2)
71
72/* The FE_DFL_ENV macro is required by standard.
73 fesetenv will use the environment set at app startup.*/
74#define FE_DFL_ENV ((const fenv_t *) 0)
75
76#ifdef __cplusplus
77extern "C" {
78#endif
79
80/*TODO: Some of these could be inlined */
81/* 7.6.2 Exception */
82
83extern int __cdecl feclearexcept (int);
84extern int __cdecl fegetexceptflag (fexcept_t * flagp, int excepts);
85extern int __cdecl feraiseexcept (int excepts );
86extern int __cdecl fesetexceptflag (const fexcept_t *, int);
87extern int __cdecl fetestexcept (int excepts);
88
89/* 7.6.3 Rounding */
90
91extern int __cdecl fegetround (void);
92extern int __cdecl fesetround (int mode);
93
94/* 7.6.4 Environment */
95
96extern int __cdecl fegetenv(fenv_t * envp);
97extern int __cdecl fesetenv(const fenv_t * );
98extern int __cdecl feupdateenv(const fenv_t *);
100
101#ifdef __cplusplus
102}
103#endif
104#endif /* Not RC_INVOKED */
105
106#endif /* ndef _FENV_H */
#define __cdecl
Definition: accygwin.h:79
unsigned short fexcept_t
Definition: fenv.h:39
int __cdecl fesetexceptflag(const fexcept_t *, int)
int __cdecl fesetenv(const fenv_t *)
int __cdecl fetestexcept(int excepts)
int __cdecl fegetround(void)
int __cdecl fegetexceptflag(fexcept_t *flagp, int excepts)
int __cdecl feholdexcept(fenv_t *)
int __cdecl feclearexcept(int)
int __cdecl feraiseexcept(int excepts)
int __cdecl fegetenv(fenv_t *envp)
int __cdecl fesetround(int mode)
int __cdecl feupdateenv(const fenv_t *)
GLenum mode
Definition: glext.h:6217
Definition: fenv.h:46
unsigned int __mxcsr
Definition: fenv.h:59
unsigned int __ip_offset
Definition: fenv.h:53
unsigned short __opcode
Definition: fenv.h:55
unsigned short __status_word
Definition: fenv.h:49
unsigned short __ip_selector
Definition: fenv.h:54
unsigned short __tag_word
Definition: fenv.h:51
unsigned short __unused3
Definition: fenv.h:58
unsigned short __control_word
Definition: fenv.h:47
unsigned int __data_offset
Definition: fenv.h:56
unsigned short __data_selector
Definition: fenv.h:57
unsigned short __unused2
Definition: fenv.h:52
unsigned short __unused0
Definition: fenv.h:48
unsigned short __unused1
Definition: fenv.h:50