mirror of https://github.com/ArduPilot/ardupilot
AP_Common: check for feenableexcept on WAF
This commit is contained in:
parent
1b775c96f5
commit
17c0cf8d5c
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include_next <fenv.h>
|
||||
|
||||
#ifndef HAVE_FEENABLEEXCEPT
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
|
||||
// Public domain polyfill for feenableexcept on OS X
|
||||
|
@ -45,4 +46,29 @@ inline int fedisableexcept(unsigned int excepts)
|
|||
return fesetenv(&fenv) ? -1 : old_excepts;
|
||||
}
|
||||
|
||||
#else
|
||||
inline int feenableexcept(unsigned int excepts)
|
||||
{
|
||||
#pragma STDC FENV_ACCESS ON
|
||||
fexcept_t flags;
|
||||
/* Save current exception flags. */
|
||||
fegetexceptflag(&flags, FE_ALL_EXCEPT);
|
||||
|
||||
feclearexcept(FE_ALL_EXCEPT); /* clear all fp exception conditions */
|
||||
return fesetexceptflag(&flags, excepts) != 0 ? -1 : flags; /* set new flags */
|
||||
|
||||
}
|
||||
|
||||
inline int fedisableexcept(unsigned int excepts)
|
||||
{
|
||||
#pragma STDC FENV_ACCESS ON
|
||||
fexcept_t flags;
|
||||
/* Save current exception flags. */
|
||||
fegetexceptflag(&flags, FE_ALL_EXCEPT);
|
||||
|
||||
feclearexcept(FE_ALL_EXCEPT); /* clear all fp exception conditions */
|
||||
return fesetexceptflag(&flags, ~excepts) != 0 ? -1 : flags; /* set new flags */
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue