00001 #include "config.h"
00002
00003
00004
00005
00006
00007 #ifndef __types_h__
00008 #define __types_h__
00009
00010 #include "headers.h"
00011
00012
00013
00014
00015 #if SIZEOF_UNSIGNED_CHAR == 1
00016 typedef unsigned char uint8;
00017 # define UINT8_CTYPE(v) ((unsigned int)(unsigned char)(v))
00018 #elif SIZEOF_UNSIGNED_SHORT == 1
00019 typedef unsigned short uint8;
00020 # define UINT8_CTYPE(v) ((unsigned short)(v))
00021 #elif SIZEOF_UNSIGNED_INT == 1
00022 typedef unsigned int uint8;
00023 # define UINT8_CTYPE(v) ((unsigned int)(v))
00024 #elif SIZEOF_UNSIGNED_LONG == 1
00025 typedef unsigned long uint8;
00026 # define UINT8_CTYPE(v) ((unsigned long)(v))
00027 #elif SIZEOF_UNSIGNED_LONG_LONG == 1
00028 typedef unsigned long long uint8;
00029 # define UINT8_CTYPE(v) ((unsigned long long)(v))
00030 #else
00031 # error *** ERROR: No 8-bit type found to use as uint8
00032 #endif
00033
00034 #define MAX_UINT8 ((uint8)-1)
00035 #if SIZEOF_SIZE_T == 1
00036 #define MAX_SIZE_T MAX_UINT8
00037 #endif
00038
00039
00040
00041
00042 #if SIZEOF_UNSIGNED_CHAR == 2
00043 typedef unsigned char uint16;
00044 # define UINT16_CTYPE(v) ((unsigned int)(unsigned char)(v))
00045 #elif SIZEOF_UNSIGNED_SHORT == 2
00046 typedef unsigned short uint16;
00047 # define UINT16_CTYPE(v) ((unsigned short)(v))
00048 #elif SIZEOF_UNSIGNED_INT == 2
00049 typedef unsigned int uint16;
00050 # define UINT16_CTYPE(v) ((unsigned int)(v))
00051 #elif SIZEOF_UNSIGNED_LONG == 2
00052 typedef unsigned long uint16;
00053 # define UINT16_CTYPE(v) ((unsigned long)(v))
00054 #elif SIZEOF_UNSIGNED_LONG_LONG == 2
00055 typedef unsigned long long uint16;
00056 # define UINT16_CTYPE(v) ((unsigned long long)(v))
00057 #else
00058 # error *** ERROR: No 16-bit type found to use as uint16
00059 #endif
00060
00061 #define MAX_UINT16 ((uint16)-1)
00062 #if SIZEOF_SIZE_T == 2
00063 #define MAX_SIZE_T MAX_UINT16
00064 #endif
00065
00066
00067
00068
00069 #if SIZEOF_UNSIGNED_CHAR == 4
00070 typedef unsigned char uint32;
00071 # define UINT32_CTYPE(v) ((unsigned int)(unsigned char)(v))
00072 #elif SIZEOF_UNSIGNED_SHORT == 4
00073 typedef unsigned short uint32;
00074 # define UINT32_CTYPE(v) ((unsigned short)(v))
00075 #elif SIZEOF_UNSIGNED_INT == 4
00076 typedef unsigned int uint32;
00077 # define UINT32_CTYPE(v) ((unsigned int)(v))
00078 #elif SIZEOF_UNSIGNED_LONG == 4
00079 typedef unsigned long uint32;
00080 # define UINT32_CTYPE(v) ((unsigned long)(v))
00081 #elif SIZEOF_UNSIGNED_LONG_LONG == 4
00082 typedef unsigned long long uint32;
00083 # define UINT32_CTYPE(v) ((unsigned long long)(v))
00084 #else
00085 # error *** ERROR: No 32-bit type found to use as uint32
00086 #endif
00087
00088 #define MAX_UINT32 ((uint32)-1)
00089 #if SIZEOF_SIZE_T == 4
00090 #define MAX_SIZE_T MAX_UINT32
00091 #endif
00092
00093
00094
00095
00096 #if SIZEOF_UNSIGNED_CHAR == 8
00097 typedef unsigned char uint64;
00098 # define UINT64_CTYPE(v) ((unsigned int)(unsigned char)(v))
00099 #elif SIZEOF_UNSIGNED_SHORT == 8
00100 typedef unsigned short uint64;
00101 # define UINT64_CTYPE(v) ((unsigned short)(v))
00102 #elif SIZEOF_UNSIGNED_INT == 8
00103 typedef unsigned int uint64;
00104 # define UINT64_CTYPE(v) ((unsigned int)(v))
00105 #elif SIZEOF_UNSIGNED_LONG == 8
00106 typedef unsigned long uint64;
00107 # define UINT64_CTYPE(v) ((unsigned long)(v))
00108 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
00109 typedef unsigned long long uint64;
00110 # define UINT64_CTYPE(v) ((unsigned long long)(v))
00111 #else
00112 # error *** ERROR: No 64-bit type found to use as uint64
00113 #endif
00114
00115 #define MAX_UINT64 ((uint64)-1)
00116 #if SIZEOF_SIZE_T == 8
00117 #define MAX_SIZE_T MAX_UINT64
00118 #endif
00119
00120 #endif