Use typedef
or using
(C++11) instead of #define
for the types, then use const
for constants. The functions can be defined as constexpr
in C++11.
typedef unsigned char UBYTE; // using UBYTE = unsigned char; // C++11
typedef unsigned long ULONG;
const unsigned int FALSE=0; // constexpr usigned int FALSE = 0; // C++11
const ULONG COMPRESS_MAX_COM=0x70000000;
const ULONG COMPRESS_MAX_ORG=(1024-COMPRESS_OVERRUN); // if COMPRESS_OVERRUN is const
const ULONG MAX_RAW_GROUP=(16*MAX_RAW_ITEM); // again if MAX_RAW_ITEM is a previously defined const
#define U(X) ((ULONG) X) // this can stay as it is
or
template <typename T>
ULONG U(const T& x)
{
return static_cast<ULONG>(x);
}
so U(some type T)
will return a cast-to-ULONG of its argument of type T
.