Add enable/disable floating point exceptions

This commit is contained in:
Danny Robson 2012-05-01 12:14:25 +10:00
parent 3fb5724683
commit 310764dcb4
2 changed files with 18 additions and 0 deletions

View File

@ -70,3 +70,17 @@ void
unusual (void) {
panic ("Unusual code path found.");
}
#include <fenv.h>
void
enable_fpe (void) {
feenableexcept (FE_DIVBYZERO | FE_INVALID);
}
void
disable_fpe (void) {
feenableexcept (0);
}

View File

@ -154,4 +154,8 @@ void unusual (void);
void breakpoint (void);
void enable_fpe (void);
void disable_fpe (void);
#endif // __DEBUG_HPP