2 * Copyright 2009-2010, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 #ifndef _CONFIG_TYPES_H
6 #define _CONFIG_TYPES_H
9 #include <config/HaikuConfig.h>
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.
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
;
27 typedef signed long long __haiku_std_int64
;
28 typedef unsigned long long __haiku_std_uint64
;
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
;
39 typedef __haiku_std_int32 __haiku_int32
;
40 typedef __haiku_std_uint32 __haiku_uint32
;
42 typedef __haiku_std_int64 __haiku_int64
;
43 typedef __haiku_std_uint64 __haiku_uint64
;
46 typedef signed long int __haiku_saddr_t
;
47 typedef unsigned long int __haiku_addr_t
;
49 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
50 typedef __haiku_int64 __haiku_phys_saddr_t
;
51 typedef __haiku_uint64 __haiku_phys_addr_t
;
53 typedef __haiku_int32 __haiku_phys_saddr_t
;
54 typedef __haiku_uint32 __haiku_phys_addr_t
;
57 /* address type limits */
58 #ifdef __HAIKU_ARCH_64_BIT
59 # define __HAIKU_SADDR_MAX (9223372036854775807LL)
60 # define __HAIKU_ADDR_MAX (18446744073709551615ULL)
62 # define __HAIKU_SADDR_MAX (2147483647)
63 # define __HAIKU_ADDR_MAX (4294967295U)
65 #define __HAIKU_SADDR_MIN (-__HAIKU_SADDR_MAX-1)
67 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
68 # define __HAIKU_PHYS_SADDR_MAX (9223372036854775807LL)
69 # define __HAIKU_PHYS_ADDR_MAX (18446744073709551615ULL)
71 # define __HAIKU_PHYS_SADDR_MAX (2147483647)
72 # define __HAIKU_PHYS_ADDR_MAX (4294967295U)
74 #define __HAIKU_PHYS_SADDR_MIN (-__HAIKU_SADDR_MAX-1)
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"
82 # define __HAIKU_STD_PRI_PREFIX_64 "ll"
85 #ifdef __HAIKU_BEOS_COMPATIBLE_TYPES
86 # define __HAIKU_PRI_PREFIX_32 "l"
88 # define __HAIKU_PRI_PREFIX_32 __HAIKU_STD_PRI_PREFIX_32
90 #define __HAIKU_PRI_PREFIX_64 __HAIKU_STD_PRI_PREFIX_64
92 #define __HAIKU_PRI_PREFIX_ADDR "l"
94 #ifdef __HAIKU_ARCH_PHYSICAL_64_BIT
95 # define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_64
97 # define __HAIKU_PRI_PREFIX_PHYS_ADDR __HAIKU_PRI_PREFIX_32
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
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
113 #endif /* _CONFIG_TYPES_H */