123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- /* $OpenBSD: milieu.h,v 1.3 2008/06/26 05:42:20 ray Exp $ */
- /* $NetBSD: milieu.h,v 1.1 2001/04/26 03:10:47 ross Exp $ */
- /* This is a derivative work. */
- /*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Ross Harvey.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
- /*
- ===============================================================================
- This C header file is part of TestFloat, Release 2a, a package of programs
- for testing the correctness of floating-point arithmetic complying to the
- IEC/IEEE Standard for Floating-Point.
- Written by John R. Hauser. More information is available through the Web
- page `http://HTTP.CS.Berkeley.EDU/~jhauser/arithmetic/TestFloat.html'.
- THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable
- effort has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT
- WILL AT TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS
- RESTRICTED TO PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL
- RESPONSIBILITY FOR ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM
- THEIR OWN USE OF THE SOFTWARE, AND WHO ALSO EFFECTIVELY INDEMNIFY
- (possibly via similar legal warning) JOHN HAUSER AND THE INTERNATIONAL
- COMPUTER SCIENCE INSTITUTE AGAINST ALL LOSSES, COSTS, OR OTHER PROBLEMS
- ARISING FROM THE USE OF THE SOFTWARE BY THEIR CUSTOMERS AND CLIENTS.
- Derivative works are acceptable, even for commercial purposes, so long as
- (1) they include prominent notice that the work is derivative, and (2) they
- include prominent notice akin to these four paragraphs for those parts of
- this code that are retained.
- ===============================================================================
- */
- #ifndef MILIEU_H
- #define MILIEU_H
- #include <sys/types.h>
- #include <sys/endian.h>
- enum {
- FALSE = 0,
- TRUE = 1
- };
- /*
- -------------------------------------------------------------------------------
- One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
- -------------------------------------------------------------------------------
- */
- #if _BYTE_ORDER == _LITTLE_ENDIAN
- #define LITTLEENDIAN
- #else
- #define BIGENDIAN
- #endif
- #define BITS64
- /*
- -------------------------------------------------------------------------------
- Each of the following `typedef's defines the most convenient type that holds
- integers of at least as many bits as specified. For example, `uint8' should
- be the most convenient type that can hold unsigned integers of as many as
- 8 bits. The `flag' type must be able to hold either a 0 or 1. For most
- implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
- to the same as `int'.
- -------------------------------------------------------------------------------
- */
- typedef int flag;
- typedef unsigned int uint8;
- typedef signed int int8;
- typedef unsigned int uint16;
- typedef int int16;
- typedef unsigned int uint32;
- typedef signed int int32;
- #ifdef BITS64
- typedef uint64_t uint64;
- typedef int64_t int64;
- #endif
- /*
- -------------------------------------------------------------------------------
- Each of the following `typedef's defines a type that holds integers
- of _exactly_ the number of bits specified. For instance, for most
- implementation of C, `bits16' and `sbits16' should be `typedef'ed to
- `unsigned short int' and `signed short int' (or `short int'), respectively.
- -------------------------------------------------------------------------------
- */
- typedef uint8_t bits8;
- typedef int8_t sbits8;
- typedef uint16_t bits16;
- typedef int16_t sbits16;
- typedef uint32_t bits32;
- typedef int32_t sbits32;
- #ifdef BITS64
- typedef uint64_t bits64;
- typedef int64_t sbits64;
- #endif
- #ifdef BITS64
- /*
- -------------------------------------------------------------------------------
- The `LIT64' macro takes as its argument a textual integer literal and
- if necessary ``marks'' the literal as having a 64-bit integer type.
- For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
- appended with the letters `LL' standing for `long long', which is `gcc's
- name for the 64-bit integer type. Some compilers may allow `LIT64' to be
- defined as the identity macro: `#define LIT64( a ) a'.
- -------------------------------------------------------------------------------
- */
- #define LIT64( a ) a##LL
- #endif
- /*
- -------------------------------------------------------------------------------
- The macro `INLINE' can be used before functions that should be inlined. If
- a compiler does not support explicit inlining, this macro should be defined
- to be `static'.
- -------------------------------------------------------------------------------
- */
- #define INLINE static inline
- #endif
|