xref: /illumos-gate/usr/src/lib/libc/port/fp/floatundisf.c (revision a8067031)
1*a8067031SRichard Lowe /*
2*a8067031SRichard Lowe  * CDDL HEADER START
3*a8067031SRichard Lowe  *
4*a8067031SRichard Lowe  * The contents of this file are subject to the terms of the
5*a8067031SRichard Lowe  * Common Development and Distribution License, Version 1.0 only
6*a8067031SRichard Lowe  * (the "License").  You may not use this file except in compliance
7*a8067031SRichard Lowe  * with the License.
8*a8067031SRichard Lowe  *
9*a8067031SRichard Lowe  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*a8067031SRichard Lowe  * or http://www.opensolaris.org/os/licensing.
11*a8067031SRichard Lowe  * See the License for the specific language governing permissions
12*a8067031SRichard Lowe  * and limitations under the License.
13*a8067031SRichard Lowe  *
14*a8067031SRichard Lowe  * When distributing Covered Code, include this CDDL HEADER in each
15*a8067031SRichard Lowe  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*a8067031SRichard Lowe  * If applicable, add the following below this CDDL HEADER, with the
17*a8067031SRichard Lowe  * fields enclosed by brackets "[]" replaced with your own identifying
18*a8067031SRichard Lowe  * information: Portions Copyright [yyyy] [name of copyright owner]
19*a8067031SRichard Lowe  *
20*a8067031SRichard Lowe  * CDDL HEADER END
21*a8067031SRichard Lowe  */
22*a8067031SRichard Lowe /*
23*a8067031SRichard Lowe  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*a8067031SRichard Lowe  * Use is subject to license terms.
25*a8067031SRichard Lowe  */
26*a8067031SRichard Lowe 
27*a8067031SRichard Lowe #include "quadint.h"
28*a8067031SRichard Lowe 
29*a8067031SRichard Lowe #pragma weak __floatundisf = ___floatundisf
30*a8067031SRichard Lowe 
31*a8067031SRichard Lowe /*
32*a8067031SRichard Lowe  * Convert an unsigned longlong_t to a single-precision floating point value.
33*a8067031SRichard Lowe  */
34*a8067031SRichard Lowe float
___floatundisf(u_longlong_t a)35*a8067031SRichard Lowe ___floatundisf(u_longlong_t a)
36*a8067031SRichard Lowe {
37*a8067031SRichard Lowe 	union uu aa;
38*a8067031SRichard Lowe 	double d;
39*a8067031SRichard Lowe 
40*a8067031SRichard Lowe 	aa.uq = a;
41*a8067031SRichard Lowe 	d = aa.ul[H];
42*a8067031SRichard Lowe 	d *= (1 << HALF_BITS);
43*a8067031SRichard Lowe 	d *= (1 << HALF_BITS);
44*a8067031SRichard Lowe 	d += aa.ul[L];
45*a8067031SRichard Lowe 
46*a8067031SRichard Lowe 	return ((float)d);
47*a8067031SRichard Lowe }
48