1281197Sandrew/*- 2281197Sandrew * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG> 3281197Sandrew * Copyright (2) 2014 The FreeBSD Foundation 4281197Sandrew * All rights reserved. 5281197Sandrew * 6281197Sandrew * Redistribution and use in source and binary forms, with or without 7281197Sandrew * modification, are permitted provided that the following conditions 8281197Sandrew * are met: 9281197Sandrew * 1. Redistributions of source code must retain the above copyright 10281197Sandrew * notice, this list of conditions and the following disclaimer. 11281197Sandrew * 2. Redistributions in binary form must reproduce the above copyright 12281197Sandrew * notice, this list of conditions and the following disclaimer in the 13281197Sandrew * documentation and/or other materials provided with the distribution. 14281197Sandrew * 15281197Sandrew * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16281197Sandrew * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17281197Sandrew * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18281197Sandrew * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19281197Sandrew * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20281197Sandrew * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21281197Sandrew * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22281197Sandrew * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23281197Sandrew * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24281197Sandrew * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25281197Sandrew * SUCH DAMAGE. 26281197Sandrew * 27281197Sandrew * $FreeBSD: releng/11.0/lib/libc/aarch64/_fpmath.h 281197 2015-04-07 09:52:14Z andrew $ 28281197Sandrew */ 29281197Sandrew 30281197Sandrewunion IEEEl2bits { 31281197Sandrew long double e; 32281197Sandrew struct { 33281197Sandrew unsigned long manl :64; 34281197Sandrew unsigned long manh :48; 35281197Sandrew unsigned int exp :15; 36281197Sandrew unsigned int sign :1; 37281197Sandrew } bits; 38281197Sandrew /* TODO andrew: Check the packing here */ 39281197Sandrew struct { 40281197Sandrew unsigned long manl :64; 41281197Sandrew unsigned long manh :48; 42281197Sandrew unsigned int expsign :16; 43281197Sandrew } xbits; 44281197Sandrew}; 45281197Sandrew 46281197Sandrew#define LDBL_NBIT 0 47281197Sandrew#define LDBL_IMPLICIT_NBIT 48281197Sandrew#define mask_nbit_l(u) ((void)0) 49281197Sandrew 50281197Sandrew#define LDBL_MANH_SIZE 48 51281197Sandrew#define LDBL_MANL_SIZE 64 52281197Sandrew 53281197Sandrew#define LDBL_TO_ARRAY32(u, a) do { \ 54281197Sandrew (a)[0] = (uint32_t)(u).bits.manl; \ 55281197Sandrew (a)[1] = (uint32_t)((u).bits.manl >> 32); \ 56281197Sandrew (a)[2] = (uint32_t)(u).bits.manh; \ 57281197Sandrew (a)[3] = (uint32_t)((u).bits.manh >> 32); \ 58281197Sandrew} while(0) 59