Back to index

glibc  2.9
Functions
feholdexcpt.c File Reference
#include <fenv.h>

Go to the source code of this file.

Functions

int feholdexcept (fenv_t *envp)

Function Documentation

int feholdexcept ( fenv_t envp)

Definition at line 23 of file feholdexcpt.c.

{
  unsigned int mxcsr;
  fenv_t temp;

  /* Store the environment.  */
  __asm__ ("fnstenv %0\n"
          "stmxcsr %1" : "=m" (temp), "=m" (temp.__mxcsr));
  *envp = temp;

  /* Now set all exceptions to non-stop, first the x87 FPU.  */
  temp.__control_word |= 0x3f;

  /* And clear all exceptions.  */
  temp.__status_word &= ~0x3f;

  __asm__ ("fldenv %0" : : "m" (temp));

  /* Set the SSE MXCSR register.  */
  mxcsr = (envp->__mxcsr | 0x1f80) & ~0x3f;
  __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));

  return 0;
}

Here is the call graph for this function: