11.4Smatt/* $NetBSD: floatundidf.c,v 1.4 2013/02/03 01:48:53 matt Exp $ */ 21.1Smatt 31.1Smatt/*- 41.1Smatt * Copyright (c) 1992, 1993 51.1Smatt * The Regents of the University of California. All rights reserved. 61.1Smatt * 71.1Smatt * This software was developed by the Computer Systems Engineering group 81.1Smatt * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 91.1Smatt * contributed to Berkeley. 101.1Smatt * 111.1Smatt * Redistribution and use in source and binary forms, with or without 121.1Smatt * modification, are permitted provided that the following conditions 131.1Smatt * are met: 141.1Smatt * 1. Redistributions of source code must retain the above copyright 151.1Smatt * notice, this list of conditions and the following disclaimer. 161.1Smatt * 2. Redistributions in binary form must reproduce the above copyright 171.1Smatt * notice, this list of conditions and the following disclaimer in the 181.1Smatt * documentation and/or other materials provided with the distribution. 191.1Smatt * 3. Neither the name of the University nor the names of its contributors 201.1Smatt * may be used to endorse or promote products derived from this software 211.1Smatt * without specific prior written permission. 221.1Smatt * 231.1Smatt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 241.1Smatt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 251.1Smatt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 261.1Smatt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 271.1Smatt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 281.1Smatt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 291.1Smatt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 301.1Smatt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 311.1Smatt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 321.1Smatt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 331.1Smatt * SUCH DAMAGE. 341.1Smatt */ 351.1Smatt 361.1Smatt#include <sys/cdefs.h> 371.1Smatt#if defined(LIBC_SCCS) && !defined(lint) 381.1Smatt#if 0 391.1Smattstatic char sccsid[] = "@(#)floatunsdidf.c 8.1 (Berkeley) 6/4/93"; 401.1Smatt#else 411.4Smatt__RCSID("$NetBSD: floatundidf.c,v 1.4 2013/02/03 01:48:53 matt Exp $"); 421.1Smatt#endif 431.1Smatt#endif /* LIBC_SCCS and not lint */ 441.1Smatt 451.4Smatt#if defined(SOFTFLOAT) || defined(__ARM_EABI__) 461.3Smatt#include "softfloat/softfloat-for-gcc.h" 471.3Smatt#endif 481.3Smatt 491.1Smatt#include "quad.h" 501.1Smatt 511.1Smatt/* 521.1Smatt * Convert (unsigned) quad to double. 531.1Smatt * This is exactly like floatdidf.c except that negatives never occur. 541.1Smatt */ 551.1Smattdouble 561.1Smatt__floatundidf(u_quad_t x) 571.1Smatt{ 581.1Smatt double d; 591.1Smatt union uu u; 601.1Smatt 611.1Smatt u.uq = x; 621.2Schristos d = (double)u.ul[H] * (((int)1 << (unsigned int)(INT_BITS - 2)) * 4.0); 631.1Smatt d += u.ul[L]; 641.1Smatt return (d); 651.1Smatt} 66