]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Main/Ipf/flt_rounds.c
SourceLevelDebugPkg: Removing ipf from edk2.
[mirror_edk2.git] / StdLib / LibC / Main / Ipf / flt_rounds.c
CommitLineData
2aa62f2b 1/*\r
2 * Written by J.T. Conklin, Apr 10, 1995\r
3 * Public domain.\r
4 */\r
5\r
6#include <sys/EfiCdefs.h>\r
7/* __FBSDID("$FreeBSD: src/lib/libc/ia64/gen/flt_rounds.c,v 1.1 2004/07/19 08:17:24 das Exp $"); */\r
8\r
9#include <float.h>\r
10\r
11static const int map[] = {\r
12 1, /* round to nearest */\r
13 3, /* round to zero */\r
14 2, /* round to negative infinity */\r
15 0 /* round to positive infinity */\r
16};\r
17\r
18int\r
19__flt_rounds(void)\r
20{\r
21 int x;\r
22\r
23 __asm("mov %0=ar.fpsr" : "=r" (x));\r
24 return (map[(x >> 10) & 0x03]);\r
25}\r