Back to index

glibc  2.9
Functions
fesetround.c File Reference
#include <fenv_libc.h>

Go to the source code of this file.

Functions

int fesetround (int round)

Function Documentation

int fesetround ( int  round)

Definition at line 24 of file fesetround.c.

{
  unsigned long fpcr;

  if (round & ~3)
    return 1;

  /* Get the current state.  */
  __asm__ __volatile__("excb; mf_fpcr %0" : "=f"(fpcr));

  /* Set the relevant bits.  */
  fpcr = ((fpcr & ~FPCR_ROUND_MASK)
         | ((unsigned long)round << FPCR_ROUND_SHIFT));

  /* Put the new state in effect.  */
  __asm__ __volatile__("mt_fpcr %0; excb" : : "f"(fpcr));

  return 0;
}

Here is the call graph for this function: