1 /* 2 * Copyright 2009-2010, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _CONFIG_TYPES_H 6 #define _CONFIG_TYPES_H 7 8 9 #include <config/HaikuConfig.h> 10 11 12 /* fixed-width types -- the __haiku_std_[u]int* types correspond to the POSIX 13 [u]int*_t types, the _haiku_[u]int* types to the BeOS [u]int* types. If 14 __HAIKU_BEOS_COMPATIBLE_TYPES is not defined both sets are identical. Once 15 we drop compatibility for good, we can consolidate the types. 16 */ 17 typedef signed char __haiku_std_int8; 18 typedef unsigned char __haiku_std_uint8; 19 typedef signed short __haiku_std_int16; 20 typedef unsigned short __haiku_std_uint16; 21 typedef signed int __haiku_std_int32; 22 typedef unsigned int __haiku_std_uint32; 23 #ifdef __HAIKU_ARCH_64_BIT 24 typedef signed long __haiku_std_int64; 25 typedef unsigned long __haiku_std_uint64; 26 #else 27 typedef signed long long __haiku_std_int64; 28 typedef unsigned long long __haiku_std_uint64; 29 #endif 30 31 typedef __haiku_std_int8 __haiku_int8; 32 typedef __haiku_std_uint8 __haiku_uint8; 33 typedef __haiku_std_int16 __haiku_int16; 34 typedef __haiku_std_uint16 __haiku_uint16; 35 #ifdef __HAIKU_BEOS_COMPATIBLE_TYPES 36 typedef signed long int __haiku_int32; 37 typedef unsigned long int __haiku_uint32; 38 #else 39 typedef __haiku_std_int32 __haiku_int32; 40 typedef __haiku_std_uint32 __haiku_uint32; 41 #endif 42 typedef __haiku_std_int64 __haiku_int64; 43 typedef __haiku_std_uint64 __haiku_uint64; 44 45 /* address types */ 46 typedef signed long int __haiku_saddr_t; 47 typedef unsigned long int __haiku_addr_t; 48 49 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT 50 typedef __haiku_int64 __haiku_phys_saddr_t; 51 typedef __haiku_uint64 __haiku_phys_addr_t; 52 #else 53 typedef __haiku_int32 __haiku_phys_saddr_t; 54 typedef __haiku_uint32 __haiku_phys_addr_t; 55 #endif 56 57 /* address type limits */ 58 #ifdef __HAIKU_ARCH_64_BIT 59 # define __HAIKU_SADDR_MAX (9223372036854775807LL) 60 # define __HAIKU_ADDR_MAX (18446744073709551615ULL) 61 #else 62 # define __HAIKU_SADDR_MAX (2147483647) 63 # define __HAIKU_ADDR_MAX (4294967295U) 64 #endif 65 #define __HAIKU_SADDR_MIN (-__HAIKU_SADDR_MAX-1) 66 67 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT 68 # define __HAIKU_PHYS_SADDR_MAX (9223372036854775807LL) 69 # define __HAIKU_PHYS_ADDR_MAX (18446744073709551615ULL) 70 #else 71 # define __HAIKU_PHYS_SADDR_MAX (2147483647) 72 # define __HAIKU_PHYS_ADDR_MAX (4294967295U) 73 #endif 74 #define __HAIKU_PHYS_SADDR_MIN (-__HAIKU_SADDR_MAX-1) 75 76 77 /* printf()/scanf() format prefixes */ 78 #define __HAIKU_STD_PRI_PREFIX_32 "" 79 #ifdef __HAIKU_ARCH_64_BIT 80 # define __HAIKU_STD_PRI_PREFIX_64 "l" 81 #else 82 # define __HAIKU_STD_PRI_PREFIX_64 "ll" 83 #endif 84 85 #ifdef __HAIKU_BEOS_COMPATIBLE_TYPES 86 # define __HAIKU_PRI_PREFIX_32 "l" 87 #else 88 # define __HAIKU_PRI_PREFIX_32 __HAIKU_STD_PRI_PREFIX_32 89 #endif 90 #define __HAIKU_PRI_PREFIX_64 __HAIKU_STD_PRI_PREFIX_64 91 92 #define __HAIKU_PRI_PREFIX_ADDR "l" 93 94 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT 95 # define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_64 96 #else 97 # define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_32 98 #endif 99 100 101 /* a generic address type wide enough for virtual and physical addresses */ 102 #if __HAIKU_ARCH_BITS >= __HAIKU_ARCH_PHYSICAL_BITS 103 typedef __haiku_addr_t __haiku_generic_addr_t; 104 # define __HAIKU_GENERIC_ADDR_MAX __HAIKU_ADDR_MAX 105 # define __HAIKU_PRI_PREFIX_GENERIC_ADDR __HAIKU_PRI_PREFIX_ADDR 106 #else 107 typedef __haiku_phys_addr_t __haiku_generic_addr_t; 108 # define __HAIKU_GENERIC_ADDR_MAX __HAIKU_PHYS_ADDR_MAX 109 # define __HAIKU_PRI_PREFIX_GENERIC_ADDR __HAIKU_PRI_PREFIX_PHYS_ADDR 110 #endif 111 112 113 #endif /* _CONFIG_TYPES_H */ 114