Created
April 1, 2016 11:57
-
-
Save epatel/ec14f7a699ce8a502bfbb964368a58b0 to your computer and use it in GitHub Desktop.
Enable SIGFPE for iOS/Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fenv_t fe; | |
if (fegetenv(&fe) != 0) { | |
// error | |
} | |
#if defined __arm__ | |
fe.__fpscr |= __fpscr_trap_divbyzero; | |
#elif defined __i386__ | |
fe.__control &= ~FE_DIVBYZERO; | |
fe.__mxcsr &= ~_MM_MASK_DIV_ZERO; | |
#else | |
#error unknown processor architecture | |
#endif | |
if (fesetenv(&fe) != 0) { | |
// error | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment