diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/common_funcs.h | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 04ecac959..c029dc7b3 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | // Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project | 1 | // Copyright 2019 yuzu emulator team |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <algorithm> | 7 | #include <algorithm> |
| 8 | #include <array> | ||
| 8 | #include <string> | 9 | #include <string> |
| 9 | 10 | ||
| 10 | #if !defined(ARCHITECTURE_x86_64) | 11 | #if !defined(ARCHITECTURE_x86_64) |
| @@ -16,18 +17,15 @@ | |||
| 16 | #define CONCAT2(x, y) DO_CONCAT2(x, y) | 17 | #define CONCAT2(x, y) DO_CONCAT2(x, y) |
| 17 | #define DO_CONCAT2(x, y) x##y | 18 | #define DO_CONCAT2(x, y) x##y |
| 18 | 19 | ||
| 19 | // helper macro to properly align structure members. | 20 | /// Helper macros to insert unused bytes or words to properly align structs. These values will be |
| 20 | // Calling INSERT_PADDING_BYTES will add a new member variable with a name like "pad121", | 21 | /// zero-initialized. |
| 21 | // depending on the current source line to make sure variable names are unique. | 22 | #define INSERT_PADDING_BYTES(num_bytes) std::array<u8, num_bytes> CONCAT2(pad, __LINE__){}; |
| 22 | #define INSERT_PADDING_BYTES(num_bytes) u8 CONCAT2(pad, __LINE__)[(num_bytes)] | 23 | #define INSERT_PADDING_WORDS(num_words) std::array<u32, num_words> CONCAT2(pad, __LINE__){}; |
| 23 | #define INSERT_PADDING_WORDS(num_words) u32 CONCAT2(pad, __LINE__)[(num_words)] | ||
| 24 | 24 | ||
| 25 | // Inlining | 25 | /// These are similar to the INSERT_PADDING_* macros, but are needed for padding unions. This is |
| 26 | #ifdef _WIN32 | 26 | /// because unions can only be initialized by one member. |
| 27 | #define FORCE_INLINE __forceinline | 27 | #define INSERT_UNION_PADDING_BYTES(num_bytes) std::array<u8, num_bytes> CONCAT2(pad, __LINE__); |
| 28 | #else | 28 | #define INSERT_UNION_PADDING_WORDS(num_words) std::array<u32, num_words> CONCAT2(pad, __LINE__); |
| 29 | #define FORCE_INLINE inline __attribute__((always_inline)) | ||
| 30 | #endif | ||
| 31 | 29 | ||
| 32 | #ifndef _MSC_VER | 30 | #ifndef _MSC_VER |
| 33 | 31 | ||