diff options
Diffstat (limited to 'src/common/common_funcs.h')
| -rw-r--r-- | src/common/common_funcs.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 973d83544..4f9e514c9 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -27,6 +27,27 @@ | |||
| 27 | #define INSERT_PADDING_BYTES(num_bytes) u8 CONCAT2(pad, __LINE__)[(num_bytes)] | 27 | #define INSERT_PADDING_BYTES(num_bytes) u8 CONCAT2(pad, __LINE__)[(num_bytes)] |
| 28 | #define INSERT_PADDING_WORDS(num_words) u32 CONCAT2(pad, __LINE__)[(num_words)] | 28 | #define INSERT_PADDING_WORDS(num_words) u32 CONCAT2(pad, __LINE__)[(num_words)] |
| 29 | 29 | ||
| 30 | #ifdef _WIN32 | ||
| 31 | // Alignment | ||
| 32 | #define MEMORY_ALIGNED16(x) __declspec(align(16)) x | ||
| 33 | #define MEMORY_ALIGNED32(x) __declspec(align(32)) x | ||
| 34 | #define MEMORY_ALIGNED64(x) __declspec(align(64)) x | ||
| 35 | #define MEMORY_ALIGNED128(x) __declspec(align(128)) x | ||
| 36 | #else | ||
| 37 | // Windows compatibility | ||
| 38 | #ifdef _LP64 | ||
| 39 | #define _M_X64 1 | ||
| 40 | #else | ||
| 41 | #define _M_IX86 1 | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #define __forceinline inline __attribute__((always_inline)) | ||
| 45 | #define MEMORY_ALIGNED16(x) __attribute__((aligned(16))) x | ||
| 46 | #define MEMORY_ALIGNED32(x) __attribute__((aligned(32))) x | ||
| 47 | #define MEMORY_ALIGNED64(x) __attribute__((aligned(64))) x | ||
| 48 | #define MEMORY_ALIGNED128(x) __attribute__((aligned(128))) x | ||
| 49 | #endif | ||
| 50 | |||
| 30 | #ifndef _MSC_VER | 51 | #ifndef _MSC_VER |
| 31 | 52 | ||
| 32 | #include <errno.h> | 53 | #include <errno.h> |