1*b2653891Scheloha /* $OpenBSD: _types.h,v 1.25 2023/07/02 19:02:27 cheloha Exp $ */ 2e8428d32Smillert 3e8428d32Smillert /*- 4e8428d32Smillert * Copyright (c) 1990, 1993 5e8428d32Smillert * The Regents of the University of California. All rights reserved. 6e8428d32Smillert * 7e8428d32Smillert * Redistribution and use in source and binary forms, with or without 8e8428d32Smillert * modification, are permitted provided that the following conditions 9e8428d32Smillert * are met: 10e8428d32Smillert * 1. Redistributions of source code must retain the above copyright 11e8428d32Smillert * notice, this list of conditions and the following disclaimer. 12e8428d32Smillert * 2. Redistributions in binary form must reproduce the above copyright 13e8428d32Smillert * notice, this list of conditions and the following disclaimer in the 14e8428d32Smillert * documentation and/or other materials provided with the distribution. 15e8428d32Smillert * 3. Neither the name of the University nor the names of its contributors 16e8428d32Smillert * may be used to endorse or promote products derived from this software 17e8428d32Smillert * without specific prior written permission. 18e8428d32Smillert * 19e8428d32Smillert * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20e8428d32Smillert * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21e8428d32Smillert * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22e8428d32Smillert * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23e8428d32Smillert * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24e8428d32Smillert * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25e8428d32Smillert * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26e8428d32Smillert * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27e8428d32Smillert * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28e8428d32Smillert * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29e8428d32Smillert * SUCH DAMAGE. 30e8428d32Smillert * 31e8428d32Smillert * @(#)types.h 8.3 (Berkeley) 1/5/94 32e8428d32Smillert * @(#)ansi.h 8.2 (Berkeley) 1/4/94 33e8428d32Smillert */ 34e8428d32Smillert 352fa72412Spirofti #ifndef _MACHINE__TYPES_H_ 362fa72412Spirofti #define _MACHINE__TYPES_H_ 37e8428d32Smillert 3828644381Sguenther /* 3928644381Sguenther * _ALIGN(p) rounds p (pointer or byte index) up to a correctly-aligned 4028644381Sguenther * value for all data types (int, long, ...). The result is an 4128644381Sguenther * unsigned long and must be cast to any desired pointer type. 4228644381Sguenther * 4328644381Sguenther * _ALIGNED_POINTER is a boolean macro that checks whether an address 4428644381Sguenther * is valid to fetch data elements of type t from on this architecture. 4528644381Sguenther * This does not reflect the optimal alignment, just the possibility 4628644381Sguenther * (within reasonable limits). 4728644381Sguenther */ 4828644381Sguenther #define _ALIGNBYTES (sizeof(int) - 1) 491e370795Sderaadt #define _STACKALIGNBYTES 15 5028644381Sguenther #define _ALIGN(p) (((unsigned long)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) 5128644381Sguenther #define _ALIGNED_POINTER(p,t) 1 52ea0d1f1fSderaadt #define _MAX_PAGE_SHIFT 12 /* same as PAGE_SHIFT */ 5328644381Sguenther 54e8428d32Smillert #if defined(_KERNEL) 55e8428d32Smillert typedef struct label_t { 56431b8a08Sderaadt long val[6]; 57e8428d32Smillert } label_t; 58e8428d32Smillert #endif 59e8428d32Smillert 60e8428d32Smillert /* 7.18.1.1 Exact-width integer types */ 61015c7c34Sguenther typedef signed char __int8_t; 62e8428d32Smillert typedef unsigned char __uint8_t; 63e8428d32Smillert typedef short __int16_t; 64e8428d32Smillert typedef unsigned short __uint16_t; 65e8428d32Smillert typedef int __int32_t; 66e8428d32Smillert typedef unsigned int __uint32_t; 67e8428d32Smillert typedef long long __int64_t; 68e8428d32Smillert typedef unsigned long long __uint64_t; 69e8428d32Smillert 70e8428d32Smillert /* 7.18.1.2 Minimum-width integer types */ 71e8428d32Smillert typedef __int8_t __int_least8_t; 72e8428d32Smillert typedef __uint8_t __uint_least8_t; 73e8428d32Smillert typedef __int16_t __int_least16_t; 74e8428d32Smillert typedef __uint16_t __uint_least16_t; 75e8428d32Smillert typedef __int32_t __int_least32_t; 76e8428d32Smillert typedef __uint32_t __uint_least32_t; 77e8428d32Smillert typedef __int64_t __int_least64_t; 78e8428d32Smillert typedef __uint64_t __uint_least64_t; 79e8428d32Smillert 80e8428d32Smillert /* 7.18.1.3 Fastest minimum-width integer types */ 81e8428d32Smillert typedef __int32_t __int_fast8_t; 82e8428d32Smillert typedef __uint32_t __uint_fast8_t; 83e8428d32Smillert typedef __int32_t __int_fast16_t; 84e8428d32Smillert typedef __uint32_t __uint_fast16_t; 85e8428d32Smillert typedef __int32_t __int_fast32_t; 86e8428d32Smillert typedef __uint32_t __uint_fast32_t; 87e8428d32Smillert typedef __int64_t __int_fast64_t; 88e8428d32Smillert typedef __uint64_t __uint_fast64_t; 899bc5afabSguenther #define __INT_FAST8_MIN INT32_MIN 909bc5afabSguenther #define __INT_FAST16_MIN INT32_MIN 919bc5afabSguenther #define __INT_FAST32_MIN INT32_MIN 929bc5afabSguenther #define __INT_FAST64_MIN INT64_MIN 939bc5afabSguenther #define __INT_FAST8_MAX INT32_MAX 949bc5afabSguenther #define __INT_FAST16_MAX INT32_MAX 959bc5afabSguenther #define __INT_FAST32_MAX INT32_MAX 969bc5afabSguenther #define __INT_FAST64_MAX INT64_MAX 979bc5afabSguenther #define __UINT_FAST8_MAX UINT32_MAX 989bc5afabSguenther #define __UINT_FAST16_MAX UINT32_MAX 999bc5afabSguenther #define __UINT_FAST32_MAX UINT32_MAX 1009bc5afabSguenther #define __UINT_FAST64_MAX UINT64_MAX 101e8428d32Smillert 102e8428d32Smillert /* 7.18.1.4 Integer types capable of holding object pointers */ 103e8428d32Smillert typedef long __intptr_t; 104e8428d32Smillert typedef unsigned long __uintptr_t; 105e8428d32Smillert 106e8428d32Smillert /* 7.18.1.5 Greatest-width integer types */ 107e8428d32Smillert typedef __int64_t __intmax_t; 108e8428d32Smillert typedef __uint64_t __uintmax_t; 109e8428d32Smillert 110e8428d32Smillert /* Register size */ 111562b3be1Sderaadt typedef long __register_t; 112e8428d32Smillert 113e8428d32Smillert /* VM system types */ 114e8428d32Smillert typedef unsigned long __vaddr_t; 1157af97067Stom typedef unsigned long __paddr_t; 116e8428d32Smillert typedef unsigned long __vsize_t; 1177af97067Stom typedef unsigned long __psize_t; 118e8428d32Smillert 119e8428d32Smillert /* Standard system types */ 1207c79e328Smartynas typedef long double __double_t; 1217c79e328Smartynas typedef long double __float_t; 1220afc3bcdSmillert typedef long __ptrdiff_t; 1230afc3bcdSmillert typedef unsigned long __size_t; 1240afc3bcdSmillert typedef long __ssize_t; 125e8428d32Smillert #if defined(__GNUC__) && __GNUC__ >= 3 126e8428d32Smillert typedef __builtin_va_list __va_list; 127e8428d32Smillert #else 128e8428d32Smillert typedef char * __va_list; 129e8428d32Smillert #endif 130e8428d32Smillert 131e8428d32Smillert /* Wide character support types */ 132e8428d32Smillert #ifndef __cplusplus 133e8428d32Smillert typedef int __wchar_t; 134e8428d32Smillert #endif 135e8428d32Smillert typedef int __wint_t; 136e8428d32Smillert typedef int __rune_t; 137e8428d32Smillert typedef void * __wctrans_t; 138e8428d32Smillert typedef void * __wctype_t; 139e8428d32Smillert 1402fa72412Spirofti #endif /* _MACHINE__TYPES_H_ */ 141