summaryrefslogtreecommitdiff
path: root/src/common/common.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/common.h43
1 files changed, 5 insertions, 38 deletions
diff --git a/src/common/common.h b/src/common/common.h
index a4a403fb9..00d1d14f9 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -11,8 +11,6 @@
11#include <cstdio> 11#include <cstdio>
12#include <cstring> 12#include <cstring>
13 13
14#define STACKALIGN
15
16#include "common/assert.h" 14#include "common/assert.h"
17#include "common/logging/log.h" 15#include "common/logging/log.h"
18#include "common/common_types.h" 16#include "common/common_types.h"
@@ -20,56 +18,25 @@
20#include "common/common_paths.h" 18#include "common/common_paths.h"
21#include "common/platform.h" 19#include "common/platform.h"
22 20
23#ifdef __APPLE__ 21#ifdef _WIN32
24// The Darwin ABI requires that stack frames be aligned to 16-byte boundaries. 22 // Alignment
25// This is only needed on i386 gcc - x86_64 already aligns to 16 bytes.
26 #if defined __i386__ && defined __GNUC__
27 #undef STACKALIGN
28 #define STACKALIGN __attribute__((__force_align_arg_pointer__))
29 #endif
30#elif defined _WIN32
31// Check MSC ver
32 #if defined _MSC_VER && _MSC_VER <= 1000
33 #error needs at least version 1000 of MSC
34 #endif
35
36 #ifndef NOMINMAX
37 #define NOMINMAX
38 #endif
39
40// Alignment
41 #define MEMORY_ALIGNED16(x) __declspec(align(16)) x 23 #define MEMORY_ALIGNED16(x) __declspec(align(16)) x
42 #define MEMORY_ALIGNED32(x) __declspec(align(32)) x 24 #define MEMORY_ALIGNED32(x) __declspec(align(32)) x
43 #define MEMORY_ALIGNED64(x) __declspec(align(64)) x 25 #define MEMORY_ALIGNED64(x) __declspec(align(64)) x
44 #define MEMORY_ALIGNED128(x) __declspec(align(128)) x 26 #define MEMORY_ALIGNED128(x) __declspec(align(128)) x
45 #define MEMORY_ALIGNED16_DECL(x) __declspec(align(16)) x 27#else
46 #define MEMORY_ALIGNED64_DECL(x) __declspec(align(64)) x 28 // Windows compatibility
47#endif
48
49// Windows compatibility
50#ifndef _WIN32
51 #ifdef _LP64 29 #ifdef _LP64
52 #define _M_X64 1 30 #define _M_X64 1
53 #else 31 #else
54 #define _M_IX86 1 32 #define _M_IX86 1
55 #endif 33 #endif
34
56 #define __forceinline inline __attribute__((always_inline)) 35 #define __forceinline inline __attribute__((always_inline))
57 #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x 36 #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x
58 #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x 37 #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x
59 #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x 38 #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x
60 #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x 39 #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x
61 #define MEMORY_ALIGNED16_DECL(x) __attribute__((aligned(16))) x
62 #define MEMORY_ALIGNED64_DECL(x) __attribute__((aligned(64))) x
63#endif
64
65#ifdef _MSC_VER
66 #define __strdup _strdup
67 #define __getcwd _getcwd
68 #define __chdir _chdir
69#else
70 #define __strdup strdup
71 #define __getcwd getcwd
72 #define __chdir chdir
73#endif 40#endif
74 41
75#if defined _M_GENERIC 42#if defined _M_GENERIC