xref: /haiku/headers/config/types.h (revision b55a57da7173b9af0432bd3e148d03f06161d036)
1 /*
2  * Copyright 2009, 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 typedef signed long long	__haiku_std_int64;
24 typedef unsigned long long	__haiku_std_uint64;
25 
26 typedef __haiku_std_int8	__haiku_int8;
27 typedef __haiku_std_uint8	__haiku_uint8;
28 typedef __haiku_std_int16	__haiku_int16;
29 typedef __haiku_std_uint16	__haiku_uint16;
30 #ifdef __HAIKU_BEOS_COMPATIBLE_TYPES
31 typedef signed long int		__haiku_int32;
32 typedef unsigned long int	__haiku_uint32;
33 #else
34 typedef __haiku_std_int32	__haiku_int32;
35 typedef __haiku_std_uint32	__haiku_uint32;
36 #endif
37 typedef __haiku_std_int64	__haiku_int64;
38 typedef __haiku_std_uint64	__haiku_uint64;
39 
40 /* address types */
41 #ifdef __HAIKU_ARCH_64_BIT
42 	typedef	__haiku_int64	__haiku_saddr_t;
43 	typedef	__haiku_uint64	__haiku_addr_t;
44 #else
45 	typedef	__haiku_int32	__haiku_saddr_t;
46 	typedef	__haiku_uint32	__haiku_addr_t;
47 #endif
48 
49 /* address type limits */
50 #ifdef __HAIKU_ARCH_64_BIT
51 #	define __HAIKU_SADDR_MAX	(9223372036854775807LL)
52 #	define __HAIKU_ADDR_MAX		(18446744073709551615ULL)
53 #else
54 #	define __HAIKU_SADDR_MAX	(2147483647)
55 #	define __HAIKU_ADDR_MAX		(4294967295U)
56 #endif
57 #define __HAIKU_SADDR_MIN		(-__HAIKU_SADDR_MAX-1)
58 
59 
60 /* printf()/scanf() format prefixes */
61 #define	__HAIKU_STD_PRI_PREFIX_32	""
62 #define	__HAIKU_STD_PRI_PREFIX_64	"ll"
63 
64 #ifdef __HAIKU_BEOS_COMPATIBLE_TYPES
65 #	define	__HAIKU_PRI_PREFIX_32	"l"
66 #else
67 #	define	__HAIKU_PRI_PREFIX_32	__HAIKU_STD_PRI_PREFIX_32
68 #endif
69 #define	__HAIKU_PRI_PREFIX_64		__HAIKU_STD_PRI_PREFIX_64
70 
71 #ifdef __HAIKU_ARCH_64_BIT
72 #	define __HAIKU_PRI_PREFIX_ADDR	__HAIKU_PRI_PREFIX_64
73 #else
74 #	define __HAIKU_PRI_PREFIX_ADDR	__HAIKU_PRI_PREFIX_32
75 #endif
76 
77 
78 #endif	/* _CONFIG_TYPES_H */
79