18cf5ed51SMike Barcroft /*- 2f154b03bSDavid Schultz * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG> 38cf5ed51SMike Barcroft * All rights reserved. 48cf5ed51SMike Barcroft * 58cf5ed51SMike Barcroft * Redistribution and use in source and binary forms, with or without 68cf5ed51SMike Barcroft * modification, are permitted provided that the following conditions 78cf5ed51SMike Barcroft * are met: 88cf5ed51SMike Barcroft * 1. Redistributions of source code must retain the above copyright 98cf5ed51SMike Barcroft * notice, this list of conditions and the following disclaimer. 108cf5ed51SMike Barcroft * 2. Redistributions in binary form must reproduce the above copyright 118cf5ed51SMike Barcroft * notice, this list of conditions and the following disclaimer in the 128cf5ed51SMike Barcroft * documentation and/or other materials provided with the distribution. 138cf5ed51SMike Barcroft * 148cf5ed51SMike Barcroft * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 158cf5ed51SMike Barcroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 168cf5ed51SMike Barcroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 178cf5ed51SMike Barcroft * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 188cf5ed51SMike Barcroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 198cf5ed51SMike Barcroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 208cf5ed51SMike Barcroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 218cf5ed51SMike Barcroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 228cf5ed51SMike Barcroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 238cf5ed51SMike Barcroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 248cf5ed51SMike Barcroft * SUCH DAMAGE. 258cf5ed51SMike Barcroft * 268cf5ed51SMike Barcroft * $FreeBSD$ 278cf5ed51SMike Barcroft */ 288cf5ed51SMike Barcroft 298cf5ed51SMike Barcroft union IEEEl2bits { 308cf5ed51SMike Barcroft long double e; 318cf5ed51SMike Barcroft struct { 328cf5ed51SMike Barcroft unsigned int sign :1; 33df11547fSAndrew Gallatin unsigned int exp :11; 34df11547fSAndrew Gallatin unsigned int manh :20; 35df11547fSAndrew Gallatin unsigned int manl :32; 368cf5ed51SMike Barcroft } bits; 378cf5ed51SMike Barcroft }; 388cf5ed51SMike Barcroft 398cf5ed51SMike Barcroft #define mask_nbit_l(u) ((void)0) 4092b93b37SDavid Schultz #define LDBL_IMPLICIT_NBIT 411dfab5edSDavid Schultz #define LDBL_NBIT 0 4292b93b37SDavid Schultz 43df11547fSAndrew Gallatin #define LDBL_MANH_SIZE 20 44df11547fSAndrew Gallatin #define LDBL_MANL_SIZE 32 45a8cb7ccaSDavid Schultz 4692b93b37SDavid Schultz #define LDBL_TO_ARRAY32(u, a) do { \ 4792b93b37SDavid Schultz (a)[0] = (uint32_t)(u).bits.manl; \ 48df11547fSAndrew Gallatin (a)[1] = (uint32_t)(u).bits.manh; \ 4992b93b37SDavid Schultz } while(0) 50