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 typedef wchar_t wchar;
25 
26 // Get lowest 16 bits.
27 #define GET_SHORT16(x) (sizeof(ushort)==2 ? (ushort)(x):((x)&0xffff))
28 
29 // Get lowest 32 bits.
30 #define GET_UINT32(x)  (sizeof(uint32)==4 ? (uint32)(x):((x)&0xffffffff))
31 
32 // Make 64 bit integer from two 32 bit.
33 #define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
34 
35 // Special int64 value, large enough to never be found in real life.
36 // We use it in situations, when we need to indicate that parameter
37 // is not defined and probably should be calculated inside of function.
38 // Lower part is intentionally 0x7fffffff, not 0xffffffff, to make it
39 // compatible with 32 bit int64.
40 #define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
41 
42 // Maximum uint64 value.
43 #define MAX_UINT64 INT32TO64(0xffffffff,0xffffffff)
44 #define UINT64NDF MAX_UINT64
45 
46 #endif
47