1/* 2 * Copyright 2003-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _STDINT_H_ 6#define _STDINT_H_ 7 8 9#include <config/types.h> 10 11 12/* Exact-width integer types */ 13typedef __haiku_std_int8 int8_t; 14typedef __haiku_std_uint8 uint8_t; 15 16typedef __haiku_std_int16 int16_t; 17typedef __haiku_std_uint16 uint16_t; 18 19typedef __haiku_std_int32 int32_t; 20typedef __haiku_std_uint32 uint32_t; 21 22typedef __haiku_std_int64 int64_t; 23typedef __haiku_std_uint64 uint64_t; 24 25/* Minimum-width integer types */ 26typedef int8_t int_least8_t; 27typedef uint8_t uint_least8_t; 28 29typedef int16_t int_least16_t; 30typedef uint16_t uint_least16_t; 31 32typedef int32_t int_least32_t; 33typedef uint32_t uint_least32_t; 34 35typedef int64_t int_least64_t; 36typedef uint64_t uint_least64_t; 37 38/* Fastest minimum-width integer types */ 39typedef int32_t int_fast8_t; 40typedef uint32_t uint_fast8_t; 41 42typedef int32_t int_fast16_t; 43typedef uint32_t uint_fast16_t; 44 45typedef int32_t int_fast32_t; 46typedef uint32_t uint_fast32_t; 47 48typedef int64_t int_fast64_t; 49typedef uint64_t uint_fast64_t; 50 51/* Integer types capable of holding object pointers */ 52typedef __haiku_saddr_t intptr_t; 53typedef __haiku_addr_t uintptr_t; 54 55/* Greatest-width integer types */ 56typedef int64_t intmax_t; 57typedef uint64_t uintmax_t; 58 59/* Limits of exact-width integer types */ 60#define INT8_MIN (-128) 61#define INT8_MAX (127) 62#define UINT8_MAX (255U) 63 64#define INT16_MIN (-32768) 65#define INT16_MAX (32767) 66#define UINT16_MAX (65535U) 67 68#define INT32_MAX (2147483647) 69#define INT32_MIN (-INT32_MAX-1) 70#define UINT32_MAX (4294967295U) 71 72#define INT64_MAX (9223372036854775807LL) 73#define INT64_MIN (-INT64_MAX-1) 74#define UINT64_MAX (18446744073709551615ULL) 75 76/* Limits of minimum-width integer types */ 77#define INT_LEAST8_MIN INT8_MIN 78#define INT_LEAST8_MAX INT8_MAX 79#define UINT_LEAST8_MAX UINT8_MAX 80 81#define INT_LEAST16_MIN INT16_MIN 82#define INT_LEAST16_MAX INT16_MAX 83#define UINT_LEAST16_MAX UINT16_MAX 84 85#define INT_LEAST32_MIN INT32_MIN 86#define INT_LEAST32_MAX INT32_MAX 87#define UINT_LEAST32_MAX UINT32_MAX 88 89#define INT_LEAST64_MIN INT64_MIN 90#define INT_LEAST64_MAX INT64_MAX 91#define UINT_LEAST64_MAX UINT64_MAX 92 93/* Limits of fastest minimum-width integer types */ 94#define INT_FAST8_MIN INT8_MIN 95#define INT_FAST8_MAX INT8_MAX 96#define UINT_FAST8_MAX UINT8_MAX 97 98#define INT_FAST16_MIN INT16_MIN 99#define INT_FAST16_MAX INT16_MAX 100#define UINT_FAST16_MAX UINT16_MAX 101 102#define INT_FAST32_MIN INT32_MIN 103#define INT_FAST32_MAX INT32_MAX 104#define UINT_FAST32_MAX UINT32_MAX 105 106#define INT_FAST64_MIN INT64_MIN 107#define INT_FAST64_MAX INT64_MAX 108#define UINT_FAST64_MAX UINT64_MAX 109 110/* Limits of Integer types capable of holding object pointers */ 111#define INTPTR_MIN __HAIKU_SADDR_MIN 112#define INTPTR_MAX __HAIKU_SADDR_MAX 113#define UINTPTR_MAX __HAIKU_ADDR_MAX 114 115/* Limits of Greatest-width integer types */ 116#define INTMAX_MIN INT64_MIN 117#define INTMAX_MAX INT64_MAX 118#define UINTMAX_MAX UINT64_MAX 119 120/* Limits of other integer types */ 121#define PTDIFF_MIN __HAIKU_SADDR_MIN 122#define PTDIFF_MAX __HAIKU_SADDR_MAX 123 124#define SIG_ATOMIC_MIN INT32_MIN 125#define SIG_ATOMIC_MAX INT32_MAX 126 127#define SIZE_MAX __HAIKU_ADDR_MAX 128 129#define WINT_MIN 0 130#define WINT_MAX ((wint_t)-1) 131 132 133#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) 134 135/* Macros of Integer Constant Expressions */ 136#define INT8_C(value) value 137#define INT16_C(value) value 138#define INT32_C(value) value 139#define INT64_C(value) value ## LL 140 141#define UINT8_C(value) value ## U 142#define UINT16_C(value) value ## U 143#define UINT32_C(value) value ## U 144#define UINT64_C(value) value ## ULL 145 146/* Macros for greatest-width integer constant expressions */ 147#define INTMAX_C(value) value ## LL 148#define UINTMAX_C(value) value ## ULL 149 150#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ 151 152 153/* BSD compatibility */ 154typedef uint8_t u_int8_t; 155typedef uint16_t u_int16_t; 156typedef uint32_t u_int32_t; 157typedef uint64_t u_int64_t; 158 159 160#endif /* _STDINT_H_ */ 161