X-Git-Url: https://sfsrealm.hopto.org/projects/?a=blobdiff_plain;f=SFTypes.h;h=07adb3c72d7969c7d7dbc4a565ff80e0b9335268;hb=212e7d696e798215d4cddfcb5007c212814728e6;hp=4e91523fbf077549523ecf99a228140925986c4d;hpb=1c63ef2a5d9f881e1006c4c674a81cebd9596c5e;p=SFmpqapi.git diff --git a/SFTypes.h b/SFTypes.h index 4e91523..07adb3c 100644 --- a/SFTypes.h +++ b/SFTypes.h @@ -1,16 +1,50 @@ +// License information for this code is in license.txt + #ifndef SFTYPES_INCLUDED #define SFTYPES_INCLUDED +#if defined(_WIN32) || defined(_WIN64) + typedef signed char Int8; typedef signed short Int16; typedef signed long Int32; typedef signed __int64 Int64; +#ifdef _WIN64 +typedef signed __int64 IntPtr; +#else +typedef signed int IntPtr; +#endif + typedef unsigned char UInt8; typedef unsigned short UInt16; typedef unsigned long UInt32; typedef unsigned __int64 UInt64; +#ifdef _WIN64 +typedef unsigned __int64 UIntPtr; +#else +typedef unsigned int UIntPtr; +#endif + +#else + +#include + +typedef int8_t Int8; +typedef int16_t Int16; +typedef int32_t Int32; +typedef int64_t Int64; +typedef intptr_t IntPtr; + +typedef uint8_t UInt8; +typedef uint16_t UInt16; +typedef uint32_t UInt32; +typedef uint64_t UInt64; +typedef uintptr_t UIntPtr; + +#endif + union IntConv { Int8 i8[8]; UInt8 ui8[8]; @@ -22,5 +56,11 @@ union IntConv { UInt64 ui64; }; +#define SplitUInt64(L_Low, L_High, R) \ + L_Low = (UInt32)(R); \ + L_High = (UInt32)((R) >> 32); + +#define MakeUInt64(R_Low, R_High) ((UInt64)(R_Low) + ((UInt64)(R_High) << 32)) + #endif // #ifndef SFTYPES_INCLUDED