]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/powerpc/fpu/s_lrint.c
Update to LGPL v2.1.
[thirdparty/glibc.git] / sysdeps / powerpc / fpu / s_lrint.c
CommitLineData
0413b54c
UD
1/* Round floating-point to integer. PowerPC version.
2 Copyright (C) 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
0413b54c
UD
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
0413b54c 14
41bdb6e2
AJ
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18 02111-1307 USA. */
0413b54c
UD
19
20#include "math.h"
21
0413b54c 22long int
b9b49b44 23__lrint (double x)
0413b54c
UD
24{
25 union {
26 double d;
27 long int ll[2];
28 } u;
29 asm ("fctiw %0,%1" : "=f"(u.d) : "f"(x));
b9b49b44 30 return u.ll[1];
0413b54c 31}
b9b49b44
UD
32weak_alias (__lrint, lrint)
33
34/* This code will also work for a 'float' argument. */
c891b2df
UD
35asm ("\n\
36 .globl __lrintf \n\
37 .globl lrintf \n\
38 .weak lrintf \n\
39 .set __lrintf,__lrint \n\
40 .set lrintf,__lrint \n\
b9b49b44 41");
0413b54c 42
b9b49b44
UD
43#ifdef NO_LONG_DOUBLE
44strong_alias (__lrint, __lrintl)
45weak_alias (__lrint, lrintl)
0413b54c 46#endif