1 #ifndef _RAR_TYPES_
2 #define _RAR_TYPES_
3 
4 typedef unsigned char    byte;   // unsigned 8 bits
5 typedef unsigned short   ushort; // preferably 16 bits, but can be more
6 typedef unsigned int     uint;   // 32 bits or more
7 
8 #define PRESENT_INT32 // undefine if signed 32 bits is not available
9 
10 typedef unsigned int     uint32; // 32 bits exactly
11 typedef   signed int     int32;  // signed 32 bits exactly
12 
13 // If compiler does not support 64 bit variables, we can define
14 // uint64 and int64 as 32 bit, but it will limit the maximum processed
15 // file size to 2 GB.
16 #if defined(__BORLANDC__) || defined(_MSC_VER)
17 typedef   unsigned __int64 uint64; // unsigned 64 bits
18 typedef     signed __int64  int64; // signed 64 bits
19 #else
20 typedef unsigned long long uint64; // unsigned 64 bits
21 typedef   signed long long  int64; // signed 64 bits
22 #endif
23 
24 
25 #if defined(_WIN_ALL) || defined(__GNUC__) || defined(__sgi) || defined(_AIX) || defined(__sun) || defined(__hpux) || defined(_OSF_SOURCE)
26 typedef wchar_t wchar;
27 #else
28 typedef ushort wchar;
29 #endif
30 
31 // Get lowest 16 bits.
32 #define SHORT16(x) (sizeof(ushort)==2 ? (ushort)(x):((x)&0xffff))
33 
34 // Get lowest 32 bits.
35 #define UINT32(x)  (sizeof(uint32)==4 ? (uint32)(x):((x)&0xffffffff))
36 
37 // Make 64 bit integer from two 32 bit.
38 #define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
39 
40 // Special int64 value, large enough to never be found in real life.
41 // We use it in situations, when we need to indicate that parameter
42 // is not defined and probably should be calculated inside of function.
43 // Lower part is intentionally 0x7fffffff, not 0xffffffff, to make it
44 // compatible with 32 bit int64.
45 #define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
46 
47 #endif
48