From 9897c0cbbcd4375067bf360f53bd5f207ec81f87 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 30 Sep 2015 14:21:42 -0400 Subject: [PATCH] Introduce portable types to R4300 system types header. --- Source/Project64/N64 System/Types.h | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/Source/Project64/N64 System/Types.h b/Source/Project64/N64 System/Types.h index 7fef3a873..8c401cab9 100644 --- a/Source/Project64/N64 System/Types.h +++ b/Source/Project64/N64 System/Types.h @@ -10,6 +10,28 @@ ****************************************************************************/ #pragma once +/* + * Some versions of Microsoft Visual C/++ compilers before Visual Studio 2010 + * have removed in favor of these nonstandard built-in types: + */ +#if defined(_MSC_VER) && (_MSC_VER < 1600) +typedef signed __int8 int8_t; +typedef signed __int16 int16_t; +typedef signed __int32 int32_t; +typedef signed __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; +#else +#include +#endif + +/* + * To do: Use fixed-size types for MIPS union members, not WINAPI types. + * On Win32 x86, `unsigned long DWORD` versus `int32_t` is the only conflict. + */ typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long DWORD; @@ -19,23 +41,25 @@ typedef int BOOL; union MIPS_WORD { long W; - float F; unsigned long UW; short HW[2]; unsigned short UHW[2]; char B[4]; unsigned char UB[4]; + + float F; }; union MIPS_DWORD { - double D; __int64 DW; unsigned __int64 UDW; long W[2]; - float F[2]; unsigned long UW[2]; short HW[4]; unsigned short UHW[4]; char B[8]; unsigned char UB[8]; + + double D; + float F[2]; };