Welcome to mirror list, hosted at ThFree Co, Russian Federation.

fegetround.c « mingwex « mingw « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 01d42849fb18ef6254da4670f30883fd893e137b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <fenv.h>
#include "cpu_features.h"

/* 7.6.3.1
   The fegetround function returns the value of the rounding direction
   macro representing the current rounding direction.  */

int
fegetround (void)
{
  unsigned short _cw;
  __asm__ ("fnstcw %0;"	: "=m" (_cw));

  /* If the MXCSR flag is different, there is no way to indicate, so just
     report the FPU flag. */
  return _cw
          & (FE_TONEAREST | FE_DOWNWARD | FE_UPWARD | FE_TOWARDZERO);

}