Back to index

glibc  2.9
Functions
fclrexcpt.c File Reference
#include <fenv.h>
#include <unistd.h>
#include <ldsodefs.h>
#include <dl-procinfo.h>
#include <shlib-compat.h>

Go to the source code of this file.

Functions

int __feclearexcept (int excepts)
 versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2)

Function Documentation

int __feclearexcept ( int  excepts)

Definition at line 27 of file fclrexcpt.c.

{
  fenv_t temp;

  /* Mask out unsupported bits/exceptions.  */
  excepts &= FE_ALL_EXCEPT;

  /* Bah, we have to clear selected exceptions.  Since there is no
     `fldsw' instruction we have to do it the hard way.  */
  __asm__ ("fnstenv %0" : "=m" (*&temp));

  /* Clear the relevant bits.  */
  temp.__status_word &= excepts ^ FE_ALL_EXCEPT;

  /* Put the new data in effect.  */
  __asm__ ("fldenv %0" : : "m" (*&temp));

  /* If the CPU supports SSE, we clear the MXCSR as well.  */
  if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0)
    {
      unsigned int xnew_exc;

      /* Get the current MXCSR.  */
      __asm__ ("stmxcsr %0" : "=m" (*&xnew_exc));

      /* Clear the relevant bits.  */
      xnew_exc &= ~excepts;

      /* Put the new data in effect.  */
      __asm__ ("ldmxcsr %0" : : "m" (*&xnew_exc));
    }

  /* Success.  */
  return 0;
}

Here is the call graph for this function:

versioned_symbol ( libm  ,
__feclearexcept  ,
feclearexcept  ,
GLIBC_2_2   
)