11.5Sthorpej/* $NetBSD: milieu.h,v 1.5 2020/09/02 03:43:22 thorpej Exp $ */ 21.1Sross 31.1Sross/* This is a derivative work. */ 41.1Sross 51.1Sross/*- 61.1Sross * Copyright (c) 2001 The NetBSD Foundation, Inc. 71.1Sross * All rights reserved. 81.1Sross * 91.1Sross * This code is derived from software contributed to The NetBSD Foundation 101.1Sross * by Ross Harvey. 111.1Sross * 121.1Sross * Redistribution and use in source and binary forms, with or without 131.1Sross * modification, are permitted provided that the following conditions 141.1Sross * are met: 151.1Sross * 1. Redistributions of source code must retain the above copyright 161.1Sross * notice, this list of conditions and the following disclaimer. 171.1Sross * 2. Redistributions in binary form must reproduce the above copyright 181.1Sross * notice, this list of conditions and the following disclaimer in the 191.1Sross * documentation and/or other materials provided with the distribution. 201.1Sross * 211.1Sross * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 221.1Sross * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 231.1Sross * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 241.1Sross * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 251.1Sross * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 261.1Sross * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 271.1Sross * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 281.1Sross * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 291.1Sross * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 301.1Sross * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 311.1Sross * POSSIBILITY OF SUCH DAMAGE. 321.1Sross */ 331.1Sross 341.5Sthorpej/*============================================================================ 351.1Sross 361.5SthorpejThis C header file template is part of the Berkeley SoftFloat IEEE Floating- 371.5SthorpejPoint Arithmetic Package, Release 2c, by John R. Hauser. 381.1Sross 391.5SthorpejTHIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has 401.5Sthorpejbeen made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT TIMES 411.5SthorpejRESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO PERSONS 421.5SthorpejAND ORGANIZATIONS WHO CAN AND WILL TOLERATE ALL LOSSES, COSTS, OR OTHER 431.5SthorpejPROBLEMS THEY INCUR DUE TO THE SOFTWARE WITHOUT RECOMPENSE FROM JOHN HAUSER OR 441.5SthorpejTHE INTERNATIONAL COMPUTER SCIENCE INSTITUTE, AND WHO FURTHERMORE EFFECTIVELY 451.5SthorpejINDEMNIFY JOHN HAUSER AND THE INTERNATIONAL COMPUTER SCIENCE INSTITUTE 461.5Sthorpej(possibly via similar legal notice) AGAINST ALL LOSSES, COSTS, OR OTHER 471.5SthorpejPROBLEMS INCURRED BY THEIR CUSTOMERS AND CLIENTS DUE TO THE SOFTWARE, OR 481.5SthorpejINCURRED BY ANYONE DUE TO A DERIVATIVE WORK THEY CREATE USING ANY PART OF THE 491.5SthorpejSOFTWARE. 501.5Sthorpej 511.5SthorpejDerivative works require also that (1) the source code for the derivative work 521.5Sthorpejincludes prominent notice that the work is derivative, and (2) the source code 531.5Sthorpejincludes prominent notice of these three paragraphs for those parts of this 541.5Sthorpejcode that are retained. 551.5Sthorpej 561.5Sthorpej=============================================================================*/ 571.1Sross 581.1Sross#ifndef MILIEU_H 591.1Sross#define MILIEU_H 601.1Sross 611.1Sross#if !defined(_KERNEL) && !defined(_STANDALONE) 621.1Sross#include <inttypes.h> 631.1Sross#else 641.1Sross#include <sys/inttypes.h> 651.1Sross#endif 661.1Sross 671.1Sross#include <sys/endian.h> 681.1Sross 691.5Sthorpej/*---------------------------------------------------------------------------- 701.5Sthorpej| One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined. 711.5Sthorpej*----------------------------------------------------------------------------*/ 721.1Sross#if _BYTE_ORDER == _LITTLE_ENDIAN 731.1Sross#define LITTLEENDIAN 741.1Sross#else 751.1Sross#define BIGENDIAN 761.1Sross#endif 771.1Sross 781.5Sthorpej/*---------------------------------------------------------------------------- 791.5Sthorpej| The macro `BITS64' can be defined to indicate that 64-bit integer types are 801.5Sthorpej| supported by the compiler. 811.5Sthorpej*----------------------------------------------------------------------------*/ 821.1Sross#define BITS64 831.1Sross 841.5Sthorpej/*---------------------------------------------------------------------------- 851.5Sthorpej| Each of the following `typedef's defines the most convenient type that holds 861.5Sthorpej| integers of at least as many bits as specified. For example, `uint8' should 871.5Sthorpej| be the most convenient type that can hold unsigned integers of as many as 881.5Sthorpej| 8 bits. The `flag' type must be able to hold either a 0 or 1. For most 891.5Sthorpej| implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed 901.5Sthorpej| to the same as `int'. 911.5Sthorpej*----------------------------------------------------------------------------*/ 921.1Srosstypedef int flag; 931.1Srosstypedef unsigned int uint8; 941.1Srosstypedef signed int int8; 951.1Srosstypedef unsigned int uint16; 961.1Srosstypedef int int16; 971.1Srosstypedef unsigned int uint32; 981.1Srosstypedef signed int int32; 991.1Sross#ifdef BITS64 1001.1Srosstypedef uint64_t uint64; 1011.1Srosstypedef int64_t int64; 1021.1Sross#endif 1031.1Sross 1041.5Sthorpej/*---------------------------------------------------------------------------- 1051.5Sthorpej| Each of the following `typedef's defines a type that holds integers 1061.5Sthorpej| of _exactly_ the number of bits specified. For instance, for most 1071.5Sthorpej| implementation of C, `bits16' and `sbits16' should be `typedef'ed to 1081.5Sthorpej| `unsigned short int' and `signed short int' (or `short int'), respectively. 1091.5Sthorpej*----------------------------------------------------------------------------*/ 1101.1Srosstypedef uint8_t bits8; 1111.1Srosstypedef int8_t sbits8; 1121.1Srosstypedef uint16_t bits16; 1131.1Srosstypedef int16_t sbits16; 1141.1Srosstypedef uint32_t bits32; 1151.1Srosstypedef int32_t sbits32; 1161.1Sross#ifdef BITS64 1171.1Srosstypedef uint64_t bits64; 1181.1Srosstypedef int64_t sbits64; 1191.1Sross#endif 1201.1Sross 1211.1Sross#ifdef BITS64 1221.5Sthorpej/*---------------------------------------------------------------------------- 1231.5Sthorpej| The `LIT64' macro takes as its argument a textual integer literal and 1241.5Sthorpej| if necessary ``marks'' the literal as having a 64-bit integer type. 1251.5Sthorpej| For example, the GNU C Compiler (`gcc') requires that 64-bit literals be 1261.5Sthorpej| appended with the letters `LL' standing for `long long', which is `gcc's 1271.5Sthorpej| name for the 64-bit integer type. Some compilers may allow `LIT64' to be 1281.5Sthorpej| defined as the identity macro: `#define LIT64( a ) a'. 1291.5Sthorpej*----------------------------------------------------------------------------*/ 1301.1Sross#define LIT64( a ) a##LL 1311.1Sross#endif 1321.1Sross 1331.5Sthorpej/*---------------------------------------------------------------------------- 1341.5Sthorpej| The macro `INLINE' can be used before functions that should be inlined. If 1351.5Sthorpej| a compiler does not support explicit inlining, this macro should be defined 1361.5Sthorpej| to be `static'. 1371.5Sthorpej*----------------------------------------------------------------------------*/ 1381.4Schristos#define INLINE static __inline 1391.1Sross 1401.5Sthorpej#endif /* MILIEU_H */ 141