diff options
Diffstat (limited to 'src/common/common_funcs.h')
| -rw-r--r-- | src/common/common_funcs.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 88cf5250a..98421bced 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h | |||
| @@ -53,14 +53,14 @@ __declspec(dllimport) void __stdcall DebugBreak(void); | |||
| 53 | // Call directly after the command or use the error num. | 53 | // Call directly after the command or use the error num. |
| 54 | // This function might change the error code. | 54 | // This function might change the error code. |
| 55 | // Defined in Misc.cpp. | 55 | // Defined in Misc.cpp. |
| 56 | std::string GetLastErrorMsg(); | 56 | [[nodiscard]] std::string GetLastErrorMsg(); |
| 57 | 57 | ||
| 58 | #define DECLARE_ENUM_FLAG_OPERATORS(type) \ | 58 | #define DECLARE_ENUM_FLAG_OPERATORS(type) \ |
| 59 | constexpr type operator|(type a, type b) noexcept { \ | 59 | [[nodiscard]] constexpr type operator|(type a, type b) noexcept { \ |
| 60 | using T = std::underlying_type_t<type>; \ | 60 | using T = std::underlying_type_t<type>; \ |
| 61 | return static_cast<type>(static_cast<T>(a) | static_cast<T>(b)); \ | 61 | return static_cast<type>(static_cast<T>(a) | static_cast<T>(b)); \ |
| 62 | } \ | 62 | } \ |
| 63 | constexpr type operator&(type a, type b) noexcept { \ | 63 | [[nodiscard]] constexpr type operator&(type a, type b) noexcept { \ |
| 64 | using T = std::underlying_type_t<type>; \ | 64 | using T = std::underlying_type_t<type>; \ |
| 65 | return static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ | 65 | return static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ |
| 66 | } \ | 66 | } \ |
| @@ -74,22 +74,22 @@ std::string GetLastErrorMsg(); | |||
| 74 | a = static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ | 74 | a = static_cast<type>(static_cast<T>(a) & static_cast<T>(b)); \ |
| 75 | return a; \ | 75 | return a; \ |
| 76 | } \ | 76 | } \ |
| 77 | constexpr type operator~(type key) noexcept { \ | 77 | [[nodiscard]] constexpr type operator~(type key) noexcept { \ |
| 78 | using T = std::underlying_type_t<type>; \ | 78 | using T = std::underlying_type_t<type>; \ |
| 79 | return static_cast<type>(~static_cast<T>(key)); \ | 79 | return static_cast<type>(~static_cast<T>(key)); \ |
| 80 | } \ | 80 | } \ |
| 81 | constexpr bool True(type key) noexcept { \ | 81 | [[nodiscard]] constexpr bool True(type key) noexcept { \ |
| 82 | using T = std::underlying_type_t<type>; \ | 82 | using T = std::underlying_type_t<type>; \ |
| 83 | return static_cast<T>(key) != 0; \ | 83 | return static_cast<T>(key) != 0; \ |
| 84 | } \ | 84 | } \ |
| 85 | constexpr bool False(type key) noexcept { \ | 85 | [[nodiscard]] constexpr bool False(type key) noexcept { \ |
| 86 | using T = std::underlying_type_t<type>; \ | 86 | using T = std::underlying_type_t<type>; \ |
| 87 | return static_cast<T>(key) == 0; \ | 87 | return static_cast<T>(key) == 0; \ |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | namespace Common { | 90 | namespace Common { |
| 91 | 91 | ||
| 92 | constexpr u32 MakeMagic(char a, char b, char c, char d) { | 92 | [[nodiscard]] constexpr u32 MakeMagic(char a, char b, char c, char d) { |
| 93 | return u32(a) | u32(b) << 8 | u32(c) << 16 | u32(d) << 24; | 93 | return u32(a) | u32(b) << 8 | u32(c) << 16 | u32(d) << 24; |
| 94 | } | 94 | } |
| 95 | 95 | ||