fpmath.h revision 110566
184996Srobert/*- 284996Srobert * Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org> 384996Srobert * Copyright (c) 2002 David Schultz <dschultz@uclink.Berkeley.EDU> 484996Srobert * All rights reserved. 584996Srobert * 684996Srobert * Redistribution and use in source and binary forms, with or without 784996Srobert * modification, are permitted provided that the following conditions 884996Srobert * are met: 984996Srobert * 1. Redistributions of source code must retain the above copyright 1084996Srobert * notice, this list of conditions and the following disclaimer. 1184996Srobert * 2. Redistributions in binary form must reproduce the above copyright 1284996Srobert * notice, this list of conditions and the following disclaimer in the 1384996Srobert * documentation and/or other materials provided with the distribution. 1484996Srobert * 1584996Srobert * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1684996Srobert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1784996Srobert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1884996Srobert * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1984996Srobert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2091139Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2184996Srobert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2284996Srobert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2384996Srobert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2484996Srobert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2591139Sjake * SUCH DAMAGE. 2684996Srobert * 2784996Srobert * $FreeBSD: head/lib/libc/include/fpmath.h 110566 2003-02-08 20:37:55Z mike $ 2891139Sjake */ 2991139Sjake 3084996Srobert#include <sys/endian.h> 3191110Sjake#include "_fpmath.h" 3291110Sjake 3391139Sjakeunion IEEEf2bits { 3484996Srobert float f; 3591139Sjake struct { 3684996Srobert#if _BYTE_ORDER == _LITTLE_ENDIAN 3784996Srobert unsigned int man :23; 3884996Srobert unsigned int exp :8; 3985719Sjake unsigned int sign :1; 4084996Srobert#else /* _BIG_ENDIAN */ 4184996Srobert unsigned int sign :1; 4284996Srobert unsigned int exp :8; 4384996Srobert unsigned int man :23; 4484996Srobert#endif 4584996Srobert } bits; 4684996Srobert}; 4784996Srobert 4884996Srobertunion IEEEd2bits { 4984996Srobert double d; 5084996Srobert struct { 5184996Srobert#if _BYTE_ORDER == _LITTLE_ENDIAN 5285719Sjake unsigned int manl :32; 5385719Sjake unsigned int manh :20; 5485719Sjake unsigned int exp :11; 5593678Stmm unsigned int sign :1; 5693678Stmm#else /* _BIG_ENDIAN */ 5784996Srobert unsigned int sign :1; 5884996Srobert unsigned int exp :11; 5985719Sjake unsigned int manh :20; 6084996Srobert unsigned int manl :32; 6184996Srobert#endif 6284996Srobert } bits; 6384996Srobert}; 6484996Srobert