Back to index

glibc  2.9
Functions
fsetexcptflg.c File Reference
#include <fenv.h>
#include <math.h>
#include <bp-sym.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 __fesetexceptflag (const fexcept_t *flagp, int excepts)
 versioned_symbol (libm, BP_SYM(__fesetexceptflag), BP_SYM(fesetexceptflag), GLIBC_2_2)

Function Documentation

int __fesetexceptflag ( const fexcept_t flagp,
int  excepts 
)

Definition at line 29 of file fsetexcptflg.c.

{
  fenv_t temp;

  /* Get the current environment.  We have to do this since we cannot
     separately set the status word.  */
  __asm__ ("fnstenv %0" : "=m" (*&temp));

  temp.__status_word &= ~(excepts & FE_ALL_EXCEPT);
  temp.__status_word |= *flagp & excepts & FE_ALL_EXCEPT;

  /* Store the new status word (along with the rest of the environment.
     Possibly new exceptions are set but they won't get executed unless
     the next floating-point instruction.  */
  __asm__ ("fldenv %0" : : "m" (*&temp));

  /* If the CPU supports SSE, we set 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));

      /* Set the relevant bits.  */
      xnew_exc &= ~(excepts & FE_ALL_EXCEPT);
      xnew_exc |= *flagp & excepts & FE_ALL_EXCEPT;

      /* 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  ,
BP_SYM(__fesetexceptflag ,
BP_SYM(fesetexceptflag ,
GLIBC_2_2   
)