23 #ifndef Foam_feexceptErsatz_H 24 #define Foam_feexceptErsatz_H 37 inline int feenableexcept(
unsigned int excepts)
40 unsigned int new_excepts = excepts & FE_ALL_EXCEPT;
41 unsigned int old_excepts;
49 old_excepts = fenv.__fpsr & FE_ALL_EXCEPT;
51 fenv.__fpsr |= new_excepts;
52 fenv.__fpcr |= (new_excepts << 8);
54 old_excepts = fenv.__control & FE_ALL_EXCEPT;
56 fenv.__control &= ~new_excepts;
57 fenv.__mxcsr &= ~(new_excepts << 7);
60 return fesetenv(&fenv) ? -1 : old_excepts;
64 inline int fedisableexcept(
unsigned int excepts)
67 unsigned int new_excepts = excepts & FE_ALL_EXCEPT;
68 unsigned int old_excepts;
76 old_excepts = fenv.__fpsr & FE_ALL_EXCEPT;
78 fenv.__fpsr &= ~new_excepts;
79 fenv.__fpcr &= ~(new_excepts << 8);
81 old_excepts = fenv.__control & FE_ALL_EXCEPT;
83 fenv.__control |= new_excepts;
84 fenv.__mxcsr |= (new_excepts << 7);
87 return fesetenv(&fenv) ? -1 : old_excepts;