Back to index

citadel  8.12
typesize.h
Go to the documentation of this file.
00001 
00002 /*
00003    This file defines typedefs for 8, 16, and 32 bit integers.  They are:
00004    cit_int8_t default 8-bit int
00005    cit_int16_t       default 16-bit int
00006    cit_int32_t       default 32-bit int
00007    cit_int64_t       default 64-bit int (not implemented yet)
00008    cit_sint8_t       signed 8-bit int
00009    cit_sint16_t      signed 16-bit int
00010    cit_sint32_t      signed 32-bit int
00011    cit_sint64_t      signed 64-bit int (not implemented yet)
00012    cit_uint8_t       unsigned 8-bit int
00013    cit_uint16_t      unsigned 16-bit int
00014    cit_uint32_t      unsigned 32-bit int
00015    cit_uint64_t      unsigned 64-bit int (not implemented yet)
00016 
00017    The sizes are determined during the configure process; see the 
00018    AC_CHECK_SIZEOF macros in configure.in.  In no way do we assume that any
00019    given datatype is any particular width, e.g. we don't assume short is two
00020    bytes; we check for it specifically.
00021 
00022    This might seem excessively paranoid, but I've seen some WEIRD systems
00023    and some bizarre compilers (Domain/OS for instance) in my time.
00024 */
00025 
00026 #ifndef _CITADEL_UX_TYPESIZE_H
00027 #define _CITADEL_UX_TYPESIZE_H
00028 
00029 /* Include sysdep.h if not already included */
00030 #ifndef CTDLDIR
00031 # include "sysdep.h"
00032 #endif
00033 
00034 /* 8-bit - If this fails, your compiler is broken */
00035 #if SIZEOF_CHAR == 1
00036 typedef char cit_int8_t;
00037 typedef signed char cit_sint8_t;
00038 typedef unsigned char cit_uint8_t;
00039 #else
00040 # error Unable to find an 8-bit integer datatype
00041 #endif
00042 
00043 /* 16-bit - If this fails, your compiler is broken */
00044 #if SIZEOF_SHORT == 2
00045 typedef short cit_int16_t;
00046 typedef signed short cit_sint16_t;
00047 typedef unsigned short cit_uint16_t;
00048 #elif SIZEOF_INT == 2
00049 typedef int cit_int16_t;
00050 typedef signed int cit_sint16_t;
00051 typedef unsigned int cit_uint16_t;
00052 #else
00053 # error Unable to find a 16-bit integer datatype
00054 #endif
00055 
00056 /* 32-bit - If this fails, your compiler is broken */
00057 #if SIZEOF_INT == 4
00058 typedef int cit_int32_t;
00059 typedef signed int cit_sint32_t;
00060 typedef unsigned int cit_uint32_t;
00061 #elif SIZEOF_LONG == 4
00062 typedef long cit_int32_t;
00063 typedef signed long cit_sint32_t;
00064 typedef unsigned long cit_uint32_t;
00065 #else
00066 # error Unable to find a 32-bit integer datatype
00067 #endif
00068 
00069 #endif /* _CITADEL_UX_TYPESIZE_H */