From bf12f270b3c74f694c789a57cc69f414753ca080 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 6 May 2015 22:59:59 -0300 Subject: Common: Remove many unnecessary cross-platform compatibility macros --- src/common/platform.h | 40 ---------------------------------------- 1 file changed, 40 deletions(-) (limited to 'src/common/platform.h') diff --git a/src/common/platform.h b/src/common/platform.h index e27d6e31..fc680d54 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -66,45 +66,5 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// // Compiler-Specific Definitions -#if EMU_PLATFORM == PLATFORM_WINDOWS - -#include - -#ifndef NOMINMAX -#define NOMINMAX -#endif -#define EMU_FASTCALL __fastcall - -#ifdef _MSC_VER -inline struct tm* localtime_r(const time_t *clock, struct tm *result) { - if (localtime_s(result, clock) == 0) - return result; - return nullptr; -} -#endif - -#else // EMU_PLATFORM != PLATFORM_WINDOWS - -#define EMU_FASTCALL __attribute__((fastcall)) -#define __stdcall -#define __cdecl - -#define BOOL bool -#define DWORD u32 - -// TODO: Hacks.. -#include - -#include -#define stricmp(str1, str2) strcasecmp(str1, str2) -#define _stricmp(str1, str2) strcasecmp(str1, str2) -#define _snprintf snprintf -#define _getcwd getcwd -#define _tzset tzset - -typedef void EXCEPTION_POINTERS; - -#endif - #define GCC_VERSION_AVAILABLE(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || \ (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) -- cgit v1.2.3 From ae963d75f8ac37dd870054c20ff14f4e5418f661 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 6 May 2015 23:18:04 -0300 Subject: Common: Move SSE detection ifdefs to platform.h --- src/common/common.h | 16 ---------------- src/common/hash.cpp | 2 ++ src/common/platform.h | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src/common/platform.h') diff --git a/src/common/common.h b/src/common/common.h index 00d1d14f..e8d32bc9 100644 --- a/src/common/common.h +++ b/src/common/common.h @@ -39,20 +39,4 @@ #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x #endif -#if defined _M_GENERIC -# define _M_SSE 0x0 -#elif defined __GNUC__ -# if defined __SSE4_2__ -# define _M_SSE 0x402 -# elif defined __SSE4_1__ -# define _M_SSE 0x401 -# elif defined __SSSE3__ -# define _M_SSE 0x301 -# elif defined __SSE3__ -# define _M_SSE 0x300 -# endif -#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008 -# define _M_SSE 0x402 -#endif - #include "swap.h" diff --git a/src/common/hash.cpp b/src/common/hash.cpp index 0624dab8..3e62beff 100644 --- a/src/common/hash.cpp +++ b/src/common/hash.cpp @@ -5,6 +5,8 @@ #include #include "common/hash.h" +#include "common/platform.h" + #if _M_SSE >= 0x402 #include "common/cpu_detect.h" #include diff --git a/src/common/platform.h b/src/common/platform.h index fc680d54..1516dc88 100644 --- a/src/common/platform.h +++ b/src/common/platform.h @@ -63,6 +63,25 @@ #define EMU_ARCHITECTURE_X86 #endif +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Feature detection + +#if defined _M_GENERIC +# define _M_SSE 0x0 +#elif defined __GNUC__ +# if defined __SSE4_2__ +# define _M_SSE 0x402 +# elif defined __SSE4_1__ +# define _M_SSE 0x401 +# elif defined __SSSE3__ +# define _M_SSE 0x301 +# elif defined __SSE3__ +# define _M_SSE 0x300 +# endif +#elif (_MSC_VER >= 1500) || __INTEL_COMPILER // Visual Studio 2008 +# define _M_SSE 0x402 +#endif + //////////////////////////////////////////////////////////////////////////////////////////////////// // Compiler-Specific Definitions -- cgit v1.2.3