integers.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00037 #ifndef INTEGERS_H
00038 #define INTEGERS_H
00039
00040
00041 #ifdef HAVE_CONFIG_H
00042 #include "../config.h"
00043 #endif
00044
00045
00046 #include "config.h"
00047
00048
00049
00050 #define U_8_MIN 0
00051 #define U_8_MAX 255
00052 #define U_16_MIN 0
00053 #define U_16_MAX 65535
00054 #define U_32_MIN 0
00055 #define U_32_MAX 4294967295U
00056 #define U_64_MIN 0
00057 #define U_64_MAX 18446744073709551615ULL
00058
00059 #define S_8_MIN (-128)
00060 #define S_8_MAX 127
00061 #define S_16_MIN 0x8000
00062 #define S_16_MAX 0x7FFF
00063 #define S_32_MIN 0x80000000L
00064 #define S_32_MAX 0x7FFFFFFFL
00065 #define S_64_MIN 0x8000000000000000LL
00066 #define S_64_MAX 0x7FFFFFFFFFFFFFFFLL
00067
00068
00069
00070
00071 #ifndef LIBDARC_OS_BITS
00072
00073 #if LIBDARC_HAVE_INTTYPES_H
00074
00075
00076 #ifdef __cplusplus
00077 extern "C"
00078 {
00079 #endif
00080
00081 #include <inttypes.h>
00082
00083
00084 #ifndef __WORDSIZE
00085 #ifdef _WIN32
00086 # define __WORDSIZE 32
00087 #else
00088 # ifdef _WIN64
00089 # define __WORDSIZE 64
00090 # endif
00091 #endif
00092 #endif
00093
00094 #ifndef __WORDSIZE
00095 # ifdef LIBDARC_SIZEOF_INTPTR_T
00096 # if LIBDARC_SIZEOF_INTPTR_T == 4
00097 # define __WORDSIZE 32
00098 # else
00099 # if LIBDARC_SIZEOF_INTPTR_T == 8
00100 # define __WORDSIZE 64
00101 # endif
00102 # endif
00103 # endif
00104 #endif
00105
00106 #ifndef __WORDSIZE
00107 #error "Cannot determine wordsize, perhaps host is not Unix or Windows? Use --enable-os-bits=... with the 'configure' script according to your system's CPU register size"
00108 #endif
00109
00110
00111 #ifdef __cplusplus
00112 }
00113
00114 namespace libdar
00115 {
00116 #endif
00117
00118 typedef unsigned char U_8;
00119 typedef uint16_t U_16;
00120 typedef uint32_t U_32;
00121 typedef uint64_t U_64;
00122 typedef unsigned int U_I;
00123 typedef signed char S_8;
00124 typedef int16_t S_16;
00125 typedef int32_t S_32;
00126 typedef int64_t S_64;
00127 typedef signed int S_I;
00128
00129 #ifdef __cplusplus
00130 }
00131 #endif
00132
00133 #else
00134 #error "Cannot determine integer types, use --enable-os-bits=... with the 'configure' script according to your system's CPU register size"
00135 #endif
00136
00137 #else
00138 #if LIBDARC_OS_BITS == 32
00139 #define __WORDSIZE 32
00140
00141 #ifdef __cplusplus
00142 namespace libdar
00143 {
00144 #endif
00145
00146 typedef unsigned char U_8;
00147 typedef unsigned short U_16;
00148 typedef unsigned long U_32;
00149 typedef unsigned long long U_64;
00150 typedef unsigned int U_I;
00151 typedef signed char S_8;
00152 typedef signed short S_16;
00153 typedef signed long S_32;
00154 typedef signed long long S_64;
00155 typedef signed int S_I;
00156
00157 typedef int intptr_t;
00158
00159 #ifdef __cplusplus
00160 }
00161 #endif
00162
00163 #else
00164 #if LIBDARC_OS_BITS == 64
00165 #define __WORDSIZE 64
00166
00167 #ifdef __cplusplus
00168 namespace libdar
00169 {
00170 #endif
00171
00172 typedef unsigned char U_8;
00173 typedef unsigned short U_16;
00174 typedef unsigned int U_32;
00175 typedef unsigned long long U_64;
00176 typedef unsigned int U_I;
00177 typedef signed char S_8;
00178 typedef signed short S_16;
00179 typedef signed int S_32;
00180 typedef signed long long S_64;
00181 typedef signed int S_I;
00182
00183 typedef long int intptr_t;
00184
00185 #ifdef __cplusplus
00186 }
00187 #endif
00188
00189 #else
00190 #error "unknown value given to --enable-os-bits=... check the 'configure' script arguments"
00191
00192
00193
00194
00195
00196 #endif
00197 #endif
00198 #endif
00199
00200 #endif