mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 05:08:57 +00:00
Replace ARRAYSIZE macro with another ugly macro. At least this will throw an error for a non-array and won't conflict with Windows macro names.
This commit is contained in:
parent
ce49964dfe
commit
fde3815d34
7 changed files with 45 additions and 33 deletions
|
@ -12,6 +12,18 @@
|
|||
#define SLEEP(x) usleep(x*1000)
|
||||
#endif
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
// TODO: make into function when type_traits and constexpr are available
|
||||
template <typename T, std::size_t N = 0>
|
||||
struct ArraySizeImpl {};
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct ArraySizeImpl<T[N], 0> { static const std::size_t size = N; };
|
||||
|
||||
// Will fail to compile on a non-array:
|
||||
#define ArraySize(x) ArraySizeImpl<decltype(x)>::size
|
||||
|
||||
template <bool> struct CompileTimeAssert;
|
||||
template<> struct CompileTimeAssert<true> {};
|
||||
|
||||
|
@ -52,7 +64,7 @@ _mm_shuffle_epi8(__m128i a, __m128i mask)
|
|||
#else
|
||||
#define Crash() {asm ("int $3");}
|
||||
#endif
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
|
||||
// GCC 4.8 defines all the rotate functions now
|
||||
// Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit
|
||||
#ifndef _rotl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue