diff --git a/lib/Init.cc b/lib/Init.cc index 2f9619a9..221c056d 100644 --- a/lib/Init.cc +++ b/lib/Init.cc @@ -48,6 +48,26 @@ Author: paboyle #include +#include +#ifdef __APPLE__ +static int +feenableexcept (unsigned int excepts) +{ + static fenv_t fenv; + unsigned int new_excepts = excepts & FE_ALL_EXCEPT, + old_excepts; // previous masks + + if ( fegetenv (&fenv) ) return -1; + old_excepts = fenv.__control & FE_ALL_EXCEPT; + + // unmask + fenv.__control &= ~new_excepts; + fenv.__mxcsr &= ~(new_excepts << 7); + + return ( fesetenv (&fenv) ? -1 : old_excepts ); +} +#endif + namespace Grid { @@ -331,27 +351,6 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr) return; }; -#include - -#ifdef __APPLE__ -static int -feenableexcept (unsigned int excepts) -{ - static fenv_t fenv; - unsigned int new_excepts = excepts & FE_ALL_EXCEPT, - old_excepts; // previous masks - - if ( fegetenv (&fenv) ) return -1; - old_excepts = fenv.__control & FE_ALL_EXCEPT; - - // unmask - fenv.__control &= ~new_excepts; - fenv.__mxcsr &= ~(new_excepts << 7); - - return ( fesetenv (&fenv) ? -1 : old_excepts ); -} -#endif - void Grid_debug_handler_init(void) { struct sigaction sa,osa;