123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include <fenv.h>
- #include <unistd.h>
- int
- feenableexcept (int excepts)
- {
- unsigned short int new_exc;
- unsigned short int old_exc;
-
- __asm__ ("fstcw %0" : "=m" (*&new_exc));
- excepts &= FE_ALL_EXCEPT;
- old_exc = (~new_exc) & FE_ALL_EXCEPT;
- new_exc &= ~excepts;
- __asm__ ("fldcw %0" : : "m" (*&new_exc));
- #if 0
-
- if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
- {
- unsigned int xnew_exc;
-
- __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));
- xnew_exc &= ~(excepts << 7);
- __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
- }
- #endif
- return old_exc;
- }
|