From 2c7a92e1b7d30ef8a7792513df8a244454f45f45 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Sun, 31 Aug 2008 13:54:25 +0000 Subject: [PATCH] Split off type definitions from "Common.h" into new header "CommonTypes.h". This is a preparation for sharing the type definitions between the Dolphin core and the plugin specs. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@405 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Common.h | 49 +++++++------------------ Source/PluginSpecs/CommonTypes.h | 63 ++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 35 deletions(-) create mode 100644 Source/PluginSpecs/CommonTypes.h diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index 4be304a763..f1e2749569 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -18,6 +18,8 @@ #ifndef _COMMON_H #define _COMMON_H +#include "CommonTypes.h" + #include #include #include @@ -49,7 +51,6 @@ extern "C" { #endif #elif __GNUC__ -#define TCHAR char #define POSIX 1 #define MAX_PATH 260 #define stricmp strcasecmp @@ -61,21 +62,9 @@ extern "C" { #endif #endif -// Types +// Alignment -#ifdef _WIN32 - -#include - -typedef unsigned __int64 u64; -typedef unsigned __int32 u32; -typedef unsigned __int16 u16; -typedef unsigned __int8 u8; - -typedef signed __int64 s64; -typedef signed __int32 s32; -typedef signed __int16 s16; -typedef signed __int8 s8; +#if defined(_MSC_VER) #define GC_ALIGNED16(x) __declspec(align(16)) x #define GC_ALIGNED32(x) __declspec(align(32)) x @@ -85,21 +74,17 @@ typedef signed __int8 s8; #else -typedef char s8; -typedef short s16; -#define __int16 short -typedef int s32; -#define __int32 int -typedef long long s64; -#define __int64 long long +#define GC_ALIGNED16(x) __attribute((aligned(16))) x +#define GC_ALIGNED32(x) __attribute((aligned(16))) x +#define GC_ALIGNED64(x) __attribute((aligned(64))) x +#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x +#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x -typedef unsigned char u8; -typedef unsigned char BYTE; -typedef unsigned short u16; -typedef unsigned int u32; -typedef unsigned int BOOL; -typedef unsigned int DWORD; -typedef unsigned long long u64; +#endif + +// Various Windows compatibility + +#if !defined(_WIN32) #ifdef __LINUX__ typedef union _LARGE_INTEGER @@ -108,12 +93,6 @@ typedef union _LARGE_INTEGER } LARGE_INTEGER; #endif -#define GC_ALIGNED16(x) __attribute((aligned(16))) x -#define GC_ALIGNED32(x) __attribute((aligned(16))) x -#define GC_ALIGNED64(x) __attribute((aligned(64))) x -#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x -#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x - #ifndef __forceinline #define __forceinline inline #endif diff --git a/Source/PluginSpecs/CommonTypes.h b/Source/PluginSpecs/CommonTypes.h new file mode 100644 index 0000000000..9c6d9ab163 --- /dev/null +++ b/Source/PluginSpecs/CommonTypes.h @@ -0,0 +1,63 @@ +// Copyright (C) 2003-2008 Dolphin Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + + + +// This header contains type definitions that are shared between the Dolphin +// core and the plugin specs. Any definitions that are only used by the core +// should be placed in "Common.h" instead. + +#ifndef _COMMONTYPES_H +#define _COMMONTYPES_H + +#ifdef _WIN32 + +#include + +typedef unsigned __int8 u8; +typedef unsigned __int16 u16; +typedef unsigned __int32 u32; +typedef unsigned __int64 u64; + +typedef signed __int8 s8; +typedef signed __int16 s16; +typedef signed __int32 s32; +typedef signed __int64 s64; + +#else + +typedef unsigned char u8; +typedef unsigned char BYTE; +typedef unsigned short u16; +typedef unsigned int u32; +typedef unsigned int BOOL; +typedef unsigned int DWORD; +typedef unsigned long long u64; + +typedef char s8; +typedef short s16; +#define __int16 short +typedef int s32; +#define __int32 int +typedef long long s64; +#define __int64 long long + +#define TCHAR char + +#endif // _WIN32 + +#endif // _COMMONTYPES_H