1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Fenv out of grid namespace

This commit is contained in:
paboyle 2016-09-26 10:09:13 +01:00
parent 167cc2650e
commit 9353b6edfe

View File

@ -48,6 +48,26 @@ Author: paboyle <paboyle@ph.ed.ac.uk>
#include <memory> #include <memory>
#include <fenv.h>
#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 { namespace Grid {
@ -331,27 +351,6 @@ void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr)
return; return;
}; };
#include <fenv.h>
#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) void Grid_debug_handler_init(void)
{ {
struct sigaction sa,osa; struct sigaction sa,osa;