source: trunk/libs/newlib/src/newlib/libm/machine/i386/f_lrintf.c @ 519

Last change on this file since 519 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 767 bytes
Line 
1/*
2 * ====================================================
3 * x87 FP implementation contributed to Newlib by
4 * Dave Korn, November 2007.  This file is placed in the
5 * public domain.  Permission to use, copy, modify, and
6 * distribute this software is freely granted.
7 * ====================================================
8 */
9
10#if defined(__GNUC__) && !defined(_SOFT_FLOAT)
11
12#include <math.h>
13
14/*
15 * Fast math version of lrintf(x)
16 * Return x rounded to integral value according to the prevailing
17 * rounding mode.
18 * Method:
19 *      Using inline x87 asms.
20 * Exception:
21 *      Governed by x87 FPCR.
22 */
23
24long int _f_lrintf (float x)
25{
26  long int _result;
27  asm ("fistpl %0" : "=m" (_result) : "t" (x) : "st");
28  return _result;
29}
30
31#endif  /* !__GNUC__ || _SOFT_FLOAT */
32
Note: See TracBrowser for help on using the repository browser.