int
fegetexcept (void)
{
  fenv_t exc;
  __fenv_stfsr (exc);

  return (exc >> 18) & FE_ALL_EXCEPT;
}
Exemple #2
0
int
__fegetenv (fenv_t *envp)
{
  __fenv_stfsr (*envp);

  /* Success.  */
  return 0;
}
int
fetestexcept (int excepts)
{
  fenv_t tmp;

  __fenv_stfsr (tmp);

  return tmp & excepts & FE_ALL_EXCEPT;
}
Exemple #4
0
int
__fegetround (void)
{
  fenv_t tmp;

  __fenv_stfsr (tmp);

  return tmp & __FE_ROUND_MASK;
}
Exemple #5
0
int
__fegetexceptflag (fexcept_t *flagp, int excepts)
{
    fexcept_t tmp;

    /* Get the current exceptions.  */
    __fenv_stfsr (tmp);

    *flagp = tmp & excepts & FE_ALL_EXCEPT;

    /* Success.  */
    return 0;
}
Exemple #6
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;
}
Exemple #8
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;
}
Exemple #10
0
int
__feupdateenv (const fenv_t *envp)
{
  fexcept_t tmp;

  /* Save current exceptions.  */
  __fenv_stfsr (tmp);
  tmp &= FE_ALL_EXCEPT;

  /* Install new environment.  */
  __fesetenv (envp);

  /* Raise the safed 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 ((int) tmp);

  /* Success.  */
  return 0;
}