int __fesetenv (const fenv_t *envp) { fenv_t dummy; /* Put these constants in memory explicitly, so as to cope with a -fPIC bug as of gcc 970624. Making them automatic is quicker than loading up the pic register in this instance. */ if (envp == FE_DFL_ENV) { dummy = 0; envp = &dummy; } else if (envp == FE_NOMASK_ENV) { dummy = 0x1f << 23; envp = &dummy; } __fenv_ldfsr (*envp); /* Success. */ return 0; }
int __feclearexcept (int excepts) { fenv_t tmp; __fenv_stfsr (tmp); tmp &= ~(excepts & FE_ALL_EXCEPT); __fenv_ldfsr (tmp); /* Success. */ return 0; }
int feholdexcept (fenv_t *envp) { fenv_t tmp; __fenv_stfsr (*envp); /* Set all exceptions to non-stop and clear all exceptions. */ tmp = *envp & ~((0x1f << 23) | FE_ALL_EXCEPT); __fenv_ldfsr (tmp); return 0; }
int __fesetexceptflag (const fexcept_t *flagp, int excepts) { fenv_t tmp; __fenv_stfsr (tmp); tmp &= ~(excepts & FE_ALL_EXCEPT); tmp |= *flagp & excepts & FE_ALL_EXCEPT; __fenv_ldfsr (tmp); /* Success. */ return 0; }
int fesetround (int round) { fenv_t tmp; if ((round & ~__FE_ROUND_MASK) != 0) /* ROUND is no valid rounding mode. */ return 1; __fenv_stfsr (tmp); tmp &= ~__FE_ROUND_MASK; tmp |= round; __fenv_ldfsr (tmp); return 0; }