1*840b91ccSNathan Whitehorn /*- 2*840b91ccSNathan Whitehorn * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG> 3*840b91ccSNathan Whitehorn * All rights reserved. 4*840b91ccSNathan Whitehorn * 5*840b91ccSNathan Whitehorn * Redistribution and use in source and binary forms, with or without 6*840b91ccSNathan Whitehorn * modification, are permitted provided that the following conditions 7*840b91ccSNathan Whitehorn * are met: 8*840b91ccSNathan Whitehorn * 1. Redistributions of source code must retain the above copyright 9*840b91ccSNathan Whitehorn * notice, this list of conditions and the following disclaimer. 10*840b91ccSNathan Whitehorn * 2. Redistributions in binary form must reproduce the above copyright 11*840b91ccSNathan Whitehorn * notice, this list of conditions and the following disclaimer in the 12*840b91ccSNathan Whitehorn * documentation and/or other materials provided with the distribution. 13*840b91ccSNathan Whitehorn * 14*840b91ccSNathan Whitehorn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15*840b91ccSNathan Whitehorn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16*840b91ccSNathan Whitehorn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17*840b91ccSNathan Whitehorn * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18*840b91ccSNathan Whitehorn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19*840b91ccSNathan Whitehorn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20*840b91ccSNathan Whitehorn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21*840b91ccSNathan Whitehorn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22*840b91ccSNathan Whitehorn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23*840b91ccSNathan Whitehorn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24*840b91ccSNathan Whitehorn * SUCH DAMAGE. 25*840b91ccSNathan Whitehorn * 26*840b91ccSNathan Whitehorn * $FreeBSD$ 27*840b91ccSNathan Whitehorn */ 28*840b91ccSNathan Whitehorn 29*840b91ccSNathan Whitehorn union IEEEl2bits { 30*840b91ccSNathan Whitehorn long double e; 31*840b91ccSNathan Whitehorn struct { 32*840b91ccSNathan Whitehorn unsigned int sign :1; 33*840b91ccSNathan Whitehorn unsigned int exp :11; 34*840b91ccSNathan Whitehorn unsigned int manh :20; 35*840b91ccSNathan Whitehorn unsigned int manl :32; 36*840b91ccSNathan Whitehorn } bits; 37*840b91ccSNathan Whitehorn }; 38*840b91ccSNathan Whitehorn 39*840b91ccSNathan Whitehorn #define mask_nbit_l(u) ((void)0) 40*840b91ccSNathan Whitehorn #define LDBL_IMPLICIT_NBIT 41*840b91ccSNathan Whitehorn #define LDBL_NBIT 0 42*840b91ccSNathan Whitehorn 43*840b91ccSNathan Whitehorn #define LDBL_MANH_SIZE 20 44*840b91ccSNathan Whitehorn #define LDBL_MANL_SIZE 32 45*840b91ccSNathan Whitehorn 46*840b91ccSNathan Whitehorn #define LDBL_TO_ARRAY32(u, a) do { \ 47*840b91ccSNathan Whitehorn (a)[0] = (uint32_t)(u).bits.manl; \ 48*840b91ccSNathan Whitehorn (a)[1] = (uint32_t)(u).bits.manh; \ 49*840b91ccSNathan Whitehorn } while(0) 50