_fpmath.h revision 141379
1129202Scognet/*-
2141379Sdas * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
3129202Scognet * All rights reserved.
4129202Scognet *
5129202Scognet * Redistribution and use in source and binary forms, with or without
6129202Scognet * modification, are permitted provided that the following conditions
7129202Scognet * are met:
8129202Scognet * 1. Redistributions of source code must retain the above copyright
9129202Scognet *    notice, this list of conditions and the following disclaimer.
10129202Scognet * 2. Redistributions in binary form must reproduce the above copyright
11129202Scognet *    notice, this list of conditions and the following disclaimer in the
12129202Scognet *    documentation and/or other materials provided with the distribution.
13129202Scognet *
14129202Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15129202Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16129202Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17129202Scognet * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18129202Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19129202Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20129202Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21129202Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22129202Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23129202Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24129202Scognet * SUCH DAMAGE.
25129202Scognet *
26129202Scognet * $FreeBSD: head/lib/libc/arm/_fpmath.h 141379 2005-02-06 03:23:31Z das $
27129202Scognet */
28129202Scognet
29129202Scognetunion IEEEl2bits {
30129202Scognet	long double	e;
31129202Scognet	struct {
32129202Scognet		unsigned int	manl	:32;
33129202Scognet		unsigned int	manh	:32;
34129202Scognet		unsigned int	exp	:15;
35129202Scognet		unsigned int	sign	:1;
36129202Scognet		unsigned int	junk	:16;
37129202Scognet	} bits;
38129202Scognet};
39129202Scognet
40129202Scognet#define	mask_nbit_l(u)	((u).bits.manh &= 0x7fffffff)
41129202Scognet
42129202Scognet#define	LDBL_MANH_SIZE	32
43129202Scognet#define	LDBL_MANL_SIZE	32
44129202Scognet
45129202Scognet#define	LDBL_TO_ARRAY32(u, a) do {			\
46129202Scognet	(a)[0] = (uint32_t)(u).bits.manl;		\
47129202Scognet	(a)[1] = (uint32_t)(u).bits.manh;		\
48129202Scognet} while(0)
49