1 |
/* |
2 |
* Gestion du coprocesseur arithmétique (FPU : Flotting Point Unit). Deux |
3 |
* librairies sont supportées : <fenv.h> (fait parti de la glib), et |
4 |
* <float.h> (version Windows). |
5 |
* |
6 |
* Les fonctions ne sont disponnibles que si UTILISE_FENV est défini |
7 |
* (#ifdef UTILISE_FPU). |
8 |
*/ |
9 |
|
10 |
#include "hfpu.h" |
11 |
//--------------------------------------------------------------------------- |
12 |
|
13 |
#if defined(UTILISE_STATUS87) |
14 |
void fegetexceptflag (fexcept_t *flagp, fexcept_t excepts) |
15 |
{ |
16 |
fexcept_t etat; |
17 |
|
18 |
// Lit l'état actuel |
19 |
etat = _control87(0,0); |
20 |
*flagp = etat; |
21 |
|
22 |
// Change certains bits |
23 |
etat |= excepts; |
24 |
_control87 (etat, MASQUE_ERREUR_87); |
25 |
} |
26 |
#endif |
27 |
|
28 |
//--------------------------------------------------------------------------- |
29 |
|
30 |
#if defined(UTILISE_STATUS87) |
31 |
void feclearexcept (fexcept_t) |
32 |
{ |
33 |
_clear87(); |
34 |
} |
35 |
#endif |
36 |
|
37 |
//--------------------------------------------------------------------------- |
38 |
|
39 |
#if defined(UTILISE_STATUS87) |
40 |
int fetestexcept (fexcept_t excepts) |
41 |
{ |
42 |
unsigned int etat; |
43 |
etat = _status87(); |
44 |
return ((etat & excepts) == excepts); |
45 |
} |
46 |
#endif |
47 |
|
48 |
//--------------------------------------------------------------------------- |
49 |
|
50 |
#if defined(UTILISE_STATUS87) |
51 |
void fesetexceptflag (const fexcept_t *flagp, fexcept_t excepts) |
52 |
{ |
53 |
_control87 (*flagp, excepts); |
54 |
} |
55 |
#endif |
56 |
|
57 |
//--------------------------------------------------------------------------- |