a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe/*
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * CDDL HEADER START
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe *
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * The contents of this file are subject to the terms of the
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * Common Development and Distribution License, Version 1.0 only
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * (the "License"). You may not use this file except in compliance
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * with the License.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe *
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * or http://www.opensolaris.org/os/licensing.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * See the License for the specific language governing permissions
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * and limitations under the License.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe *
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * When distributing Covered Code, include this CDDL HEADER in each
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * If applicable, add the following below this CDDL HEADER, with the
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * fields enclosed by brackets "[]" replaced with your own identifying
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * information: Portions Copyright [yyyy] [name of copyright owner]
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe *
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * CDDL HEADER END
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe */
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe/*
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * Use is subject to license terms.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe */
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe#include "quadint.h"
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe#pragma weak __floatundisf = ___floatundisf
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe/*
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe * Convert an unsigned longlong_t to a single-precision floating point value.
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe */
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowefloat
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe___floatundisf(u_longlong_t a)
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe{
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe union uu aa;
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe double d;
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe aa.uq = a;
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe d = aa.ul[H];
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe d *= (1 << HALF_BITS);
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe d *= (1 << HALF_BITS);
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe d += aa.ul[L];
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe return ((float)d);
a80670315ce377f65d0b82e01c8c0538cd176f39Richard Lowe}