int fedisableexcept (int excepts) { unsigned long int new_exc, old_exc; new_exc = __ieee_get_fp_control (); old_exc = (new_exc & SWCR_ENABLE_MASK) << SWCR_ENABLE_SHIFT; new_exc &= ~((excepts >> SWCR_ENABLE_SHIFT) & SWCR_ENABLE_MASK); __ieee_set_fp_control (new_exc); return old_exc; }
int __feclearexcept (int excepts) { unsigned long int swcr; /* Get the current state. */ swcr = __ieee_get_fp_control (); /* Clear the relevant bits. */ swcr &= ~((unsigned long int) excepts & SWCR_STATUS_MASK); /* Put the new state in effect. */ __ieee_set_fp_control (swcr); /* Success. */ return 0; }
int __fesetexceptflag (const fexcept_t *flagp, int excepts) { unsigned long int tmp; /* Get the current exception state. */ tmp = __ieee_get_fp_control (); /* Set all the bits that were called for. */ tmp = (tmp & ~SWCR_STATUS_MASK) | (*flagp & excepts & SWCR_STATUS_MASK); /* And store it back. */ __ieee_set_fp_control (tmp); /* Success. */ return 0; }
set_fast_math (void) { __ieee_set_fp_control (IEEE_MAP_DMZ | IEEE_MAP_UMZ); }