1 /* 2 * Copyright 2003-2007, 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 /* ToDo: this is a compiler and architecture dependent header */ 10 11 /* Exact-width integer types */ 12 13 #define INT8_MIN (-128) 14 #define INT8_MAX (127) 15 #define UINT8_MAX (255U) 16 17 typedef signed char int8_t; 18 typedef unsigned char uint8_t; 19 20 #define INT16_MIN (-32768) 21 #define INT16_MAX (32767) 22 #define UINT16_MAX (65535U) 23 24 typedef signed short int16_t; 25 typedef unsigned short uint16_t; 26 27 #define INT32_MAX (2147483647L) 28 #define INT32_MIN (-INT32_MAX-1) 29 #define UINT32_MAX (4294967295UL) 30 31 typedef signed int int32_t; 32 typedef unsigned int uint32_t; 33 34 #define INT64_MAX (9223372036854775807LL) 35 #define INT64_MIN (-INT64_MAX-1) 36 #define UINT64_MAX (18446744073709551615ULL) 37 38 typedef signed long long int64_t; 39 typedef unsigned long long uint64_t; 40 41 42 /* Minimum-width integer types */ 43 44 #define INT_LEAST8_MIN INT8_MIN 45 #define INT_LEAST8_MAX INT8_MAX 46 #define UINT_LEAST8_MAX UINT8_MAX 47 48 typedef int8_t int_least8_t; 49 typedef uint8_t uint_least8_t; 50 51 #define INT_LEAST16_MIN INT16_MIN 52 #define INT_LEAST16_MAX INT16_MAX 53 #define UINT_LEAST16_MAX UINT16_MAX 54 55 typedef int16_t int_least16_t; 56 typedef uint16_t uint_least16_t; 57 58 #define INT_LEAST32_MIN INT32_MIN 59 #define INT_LEAST32_MAX INT32_MAX 60 #define UINT_LEAST32_MAX UINT32_MAX 61 62 typedef int32_t int_least32_t; 63 typedef uint32_t uint_least32_t; 64 65 #define INT_LEAST64_MIN INT64_MIN 66 #define INT_LEAST64_MAX INT64_MAX 67 #define UINT_LEAST64_MAX UINT64_MAX 68 69 typedef int64_t int_least64_t; 70 typedef uint64_t uint_least64_t; 71 72 73 /* Fastest minimum-width integer types */ 74 75 #define INT_FAST8_MIN INT8_MIN 76 #define INT_FAST8_MAX INT8_MAX 77 #define UINT_FAST8_MAX UINT8_MAX 78 79 typedef int32_t int_fast8_t; 80 typedef uint32_t uint_fast8_t; 81 82 #define INT_FAST16_MIN INT16_MIN 83 #define INT_FAST16_MAX INT16_MAX 84 #define UINT_FAST16_MAX UINT16_MAX 85 86 typedef int32_t int_fast16_t; 87 typedef uint32_t uint_fast16_t; 88 89 #define INT_FAST32_MIN INT32_MIN 90 #define INT_FAST32_MAX INT32_MAX 91 #define UINT_FAST32_MAX UINT32_MAX 92 93 typedef int32_t int_fast32_t; 94 typedef uint32_t uint_fast32_t; 95 96 #define INT_FAST64_MIN INT64_MIN 97 #define INT_FAST64_MAX INT64_MAX 98 #define UINT_FAST64_MAX UINT64_MAX 99 100 typedef int64_t int_fast64_t; 101 typedef uint64_t uint_fast64_t; 102 103 104 /* Integer types capable of holding object pointers */ 105 106 #define INTPTR_MIN INT32_MIN 107 #define INTPTR_MAX INT32_MAX 108 #define UINTPTR_MAX UINT32_MAX 109 110 typedef int32_t intptr_t; 111 typedef uint32_t uintptr_t; 112 113 114 /* Greatest-width integer types */ 115 116 #define INTMAX_MIN INT64_MIN 117 #define INTMAX_MAX INT64_MAX 118 #define UINTMAX_MAX UINT64_MAX 119 120 typedef signed long long intmax_t; 121 typedef unsigned long long uintmax_t; 122 123 124 /* BSD compatibility */ 125 126 typedef uint8_t u_int8_t; 127 typedef uint16_t u_int16_t; 128 typedef uint32_t u_int32_t; 129 typedef uint64_t u_int64_t; 130 131 #endif /* _STDINT_H_ */ 132