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
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef BRG_TYPES_H
00043 #define BRG_TYPES_H
00044
00045 #if defined(__cplusplus)
00046 extern "C" {
00047 #endif
00048
00049 #include <limits.h>
00050
00051 #ifndef BRG_UI8
00052 # define BRG_UI8
00053 # if UCHAR_MAX == 255u
00054 typedef unsigned char uint_8t;
00055 # else
00056 # error Please define uint_8t as an 8-bit unsigned integer type in brg_types.h
00057 # endif
00058 #endif
00059
00060 #ifndef BRG_UI16
00061 # define BRG_UI16
00062 # if USHRT_MAX == 65535u
00063 typedef unsigned short uint_16t;
00064 # else
00065 # error Please define uint_16t as a 16-bit unsigned short type in brg_types.h
00066 # endif
00067 #endif
00068
00069 #ifndef BRG_UI32
00070 # define BRG_UI32
00071 # if UINT_MAX == 4294967295u
00072 # define li_32(h) 0x##h##u
00073 typedef unsigned int uint_32t;
00074 # elif ULONG_MAX == 4294967295u
00075 # define li_32(h) 0x##h##ul
00076 typedef unsigned long uint_32t;
00077 # elif defined( _CRAY )
00078 # error This code needs 32-bit data types, which Cray machines do not provide
00079 # else
00080 # error Please define uint_32t as a 32-bit unsigned integer type in brg_types.h
00081 # endif
00082 #endif
00083
00084 #ifndef BRG_UI64
00085 # if defined( __BORLANDC__ ) && !defined( __MSDOS__ )
00086 # define BRG_UI64
00087 # define li_64(h) 0x##h##ull
00088 typedef unsigned __int64 uint_64t;
00089 # elif defined( _MSC_VER ) && ( _MSC_VER < 1300 )
00090 # define BRG_UI64
00091 # define li_64(h) 0x##h##ui64
00092 typedef unsigned __int64 uint_64t;
00093 # elif defined( __sun ) && defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful
00094 # define BRG_UI64
00095 # define li_64(h) 0x##h##ull
00096 typedef unsigned long long uint_64t;
00097 # elif defined( __MVS__ )
00098 # define li_64(h) 0x##h##ull
00099 typedef unsigned int long long uint_64t;
00100 # elif defined( UINT_MAX ) && UINT_MAX > 4294967295u
00101 # if UINT_MAX == 18446744073709551615u
00102 # define BRG_UI64
00103 # define li_64(h) 0x##h##u
00104 typedef unsigned int uint_64t;
00105 # endif
00106 # elif defined( ULONG_MAX ) && ULONG_MAX > 4294967295u
00107 # if ULONG_MAX == 18446744073709551615ul
00108 # define BRG_UI64
00109 # define li_64(h) 0x##h##ul
00110 typedef unsigned long uint_64t;
00111 # endif
00112 # elif defined( ULLONG_MAX ) && ULLONG_MAX > 4294967295u
00113 # if ULLONG_MAX == 18446744073709551615ull
00114 # define BRG_UI64
00115 # define li_64(h) 0x##h##ull
00116 typedef unsigned long long uint_64t;
00117 # endif
00118 # elif defined( ULONG_LONG_MAX ) && ULONG_LONG_MAX > 4294967295u
00119 # if ULONG_LONG_MAX == 18446744073709551615ull
00120 # define BRG_UI64
00121 # define li_64(h) 0x##h##ull
00122 typedef unsigned long long uint_64t;
00123 # endif
00124 # endif
00125 #endif
00126
00127 #if defined( NEED_UINT_64T ) && !defined( BRG_UI64 )
00128 # error Please define uint_64t as an unsigned 64 bit type in brg_types.h
00129 #endif
00130
00131 #ifndef RETURN_VALUES
00132 # define RETURN_VALUES
00133 # if defined( DLL_EXPORT )
00134 # if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
00135 # define VOID_RETURN __declspec( dllexport ) void __stdcall
00136 # define INT_RETURN __declspec( dllexport ) int __stdcall
00137 # elif defined( __GNUC__ )
00138 # define VOID_RETURN __declspec( __dllexport__ ) void
00139 # define INT_RETURN __declspec( __dllexport__ ) int
00140 # else
00141 # error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
00142 # endif
00143 # elif defined( DLL_IMPORT )
00144 # if defined( _MSC_VER ) || defined ( __INTEL_COMPILER )
00145 # define VOID_RETURN __declspec( dllimport ) void __stdcall
00146 # define INT_RETURN __declspec( dllimport ) int __stdcall
00147 # elif defined( __GNUC__ )
00148 # define VOID_RETURN __declspec( __dllimport__ ) void
00149 # define INT_RETURN __declspec( __dllimport__ ) int
00150 # else
00151 # error Use of the DLL is only available on the Microsoft, Intel and GCC compilers
00152 # endif
00153 # elif defined( __WATCOMC__ )
00154 # define VOID_RETURN void __cdecl
00155 # define INT_RETURN int __cdecl
00156 # else
00157 # define VOID_RETURN void
00158 # define INT_RETURN int
00159 # endif
00160 #endif
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 #define ui_type(size) uint_##size##t
00179 #define dec_unit_type(size,x) typedef ui_type(size) x
00180 #define dec_bufr_type(size,bsize,x) typedef ui_type(size) x[bsize / (size >> 3)]
00181 #define unit_cast(size,x) ((ui_type(size) )(x))
00182 #define ptr_cast(x,size) ((ui_type(size)*)(x))
00183
00184 #if defined(__cplusplus)
00185 }
00186 #endif
00187
00188 #endif