int fegetexcept (void) { unsigned long int exc; exc = __ieee_get_fp_control (); return (exc & SWCR_ENABLE_MASK) << SWCR_ENABLE_SHIFT; }
int fetestexcept (int excepts) { unsigned long tmp; /* Get current exceptions. */ tmp = __ieee_get_fp_control(); return tmp & excepts & SWCR_STATUS_MASK; }
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; }
int __feupdateenv (const fenv_t *envp) { unsigned long int tmp; /* Get the current exception state. */ tmp = __ieee_get_fp_control (); /* Install new environment. */ fesetenv (envp); /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the same as the ones specified using the FE_* constants. */ feraiseexcept (tmp & SWCR_STATUS_MASK); /* Success. */ return 0; }