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