Mailing list header changes (fuck you Google)
[citadel.git] / citadel / typesize.h
1
2 /*
3    This file defines typedefs for 8, 16, and 32 bit integers.  They are:
4    cit_int8_t   default 8-bit int
5    cit_int16_t  default 16-bit int
6    cit_int32_t  default 32-bit int
7    cit_int64_t  default 64-bit int (not implemented yet)
8    cit_sint8_t  signed 8-bit int
9    cit_sint16_t signed 16-bit int
10    cit_sint32_t signed 32-bit int
11    cit_sint64_t signed 64-bit int (not implemented yet)
12    cit_uint8_t  unsigned 8-bit int
13    cit_uint16_t unsigned 16-bit int
14    cit_uint32_t unsigned 32-bit int
15    cit_uint64_t unsigned 64-bit int (not implemented yet)
16
17    The sizes are determined during the configure process; see the 
18    AC_CHECK_SIZEOF macros in configure.in.  In no way do we assume that any
19    given datatype is any particular width, e.g. we don't assume short is two
20    bytes; we check for it specifically.
21
22    This might seem excessively paranoid, but I've seen some WEIRD systems
23    and some bizarre compilers (Domain/OS for instance) in my time.
24 */
25
26 #ifndef _CITADEL_UX_TYPESIZE_H
27 #define _CITADEL_UX_TYPESIZE_H
28
29 /* Include sysdep.h if not already included */
30 #ifndef CTDLDIR
31 # include "sysdep.h"
32 #endif
33
34 /* 8-bit - If this fails, your compiler is broken */
35 #if SIZEOF_CHAR == 1
36 typedef char cit_int8_t;
37 typedef signed char cit_sint8_t;
38 typedef unsigned char cit_uint8_t;
39 #else
40 # error Unable to find an 8-bit integer datatype
41 #endif
42
43 /* 16-bit - If this fails, your compiler is broken */
44 #if SIZEOF_SHORT == 2
45 typedef short cit_int16_t;
46 typedef signed short cit_sint16_t;
47 typedef unsigned short cit_uint16_t;
48 #elif SIZEOF_INT == 2
49 typedef int cit_int16_t;
50 typedef signed int cit_sint16_t;
51 typedef unsigned int cit_uint16_t;
52 #else
53 # error Unable to find a 16-bit integer datatype
54 #endif
55
56 /* 32-bit - If this fails, your compiler is broken */
57 #if SIZEOF_INT == 4
58 typedef int cit_int32_t;
59 typedef signed int cit_sint32_t;
60 typedef unsigned int cit_uint32_t;
61 #elif SIZEOF_LONG == 4
62 typedef long cit_int32_t;
63 typedef signed long cit_sint32_t;
64 typedef unsigned long cit_uint32_t;
65 #else
66 # error Unable to find a 32-bit integer datatype
67 #endif
68
69 #endif /* _CITADEL_UX_TYPESIZE_H */