_fpmath.h revision 143214
155714Skris/*-
255714Skris * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
355714Skris * All rights reserved.
455714Skris *
555714Skris * Redistribution and use in source and binary forms, with or without
655714Skris * modification, are permitted provided that the following conditions
755714Skris * are met:
8296341Sdelphij * 1. Redistributions of source code must retain the above copyright
955714Skris *    notice, this list of conditions and the following disclaimer.
1055714Skris * 2. Redistributions in binary form must reproduce the above copyright
1155714Skris *    notice, this list of conditions and the following disclaimer in the
1255714Skris *    documentation and/or other materials provided with the distribution.
1355714Skris *
1455714Skris * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15296341Sdelphij * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1655714Skris * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1755714Skris * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1855714Skris * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1955714Skris * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2055714Skris * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2155714Skris * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22296341Sdelphij * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2355714Skris * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2455714Skris * SUCH DAMAGE.
2555714Skris *
2655714Skris * $FreeBSD: head/lib/libc/i386/_fpmath.h 143214 2005-03-07 04:55:22Z das $
2755714Skris */
2855714Skris
2955714Skrisunion IEEEl2bits {
3055714Skris	long double	e;
3155714Skris	struct {
3255714Skris		unsigned int	manl	:32;
3355714Skris		unsigned int	manh	:32;
3455714Skris		unsigned int	exp	:15;
3555714Skris		unsigned int	sign	:1;
3655714Skris		unsigned int	junk	:16;
37296341Sdelphij	} bits;
3855714Skris};
3955714Skris
40296341Sdelphij#define	LDBL_NBIT	0x80000000
4155714Skris#define	mask_nbit_l(u)	((u).bits.manh &= ~LDBL_NBIT)
4255714Skris
4355714Skris#define	LDBL_MANH_SIZE	32
4455714Skris#define	LDBL_MANL_SIZE	32
4555714Skris
4655714Skris#define	LDBL_TO_ARRAY32(u, a) do {			\
4755714Skris	(a)[0] = (uint32_t)(u).bits.manl;		\
4855714Skris	(a)[1] = (uint32_t)(u).bits.manh;		\
4955714Skris} while(0)
5055714Skris