/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2002, 2003 David Schultz <[email protected]>4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/2728#if defined(__VFP_FP__) || defined(__ARM_EABI__)29#define _IEEE_WORD_ORDER _BYTE_ORDER30#else31#define _IEEE_WORD_ORDER _BIG_ENDIAN32#endif3334union IEEEl2bits {35long double e;36struct {37#if _BYTE_ORDER == _LITTLE_ENDIAN38#if _IEEE_WORD_ORDER == _LITTLE_ENDIAN39unsigned int manl :32;40#endif41unsigned int manh :20;42unsigned int exp :11;43unsigned int sign :1;44#if _IEEE_WORD_ORDER == _BIG_ENDIAN45unsigned int manl :32;46#endif47#else /* _BYTE_ORDER == _LITTLE_ENDIAN */48unsigned int sign :1;49unsigned int exp :11;50unsigned int manh :20;51unsigned int manl :32;52#endif53} bits;54};5556#define LDBL_NBIT 057#define LDBL_IMPLICIT_NBIT58#define mask_nbit_l(u) ((void)0)5960#define LDBL_MANH_SIZE 2061#define LDBL_MANL_SIZE 326263#define LDBL_TO_ARRAY32(u, a) do { \64(a)[0] = (uint32_t)(u).bits.manl; \65(a)[1] = (uint32_t)(u).bits.manh; \66} while(0)676869