diff options
author | Chris Robinson <[email protected]> | 2018-11-14 06:17:47 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-14 06:17:47 -0800 |
commit | 46301a087cfa106979dd1bab5574737020c9f94f (patch) | |
tree | f19494ed4b8c532e54bc8319119dd8691f0922b5 /OpenAL32/Include | |
parent | 3021a426c027fb88bf13b36ad825b9686001a5c9 (diff) |
Use C++ a bit more with alc.cpp
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMain.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 666a8ade..b9ace4db 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -32,6 +32,15 @@ #include "threads.h" +#ifndef __cplusplus +#define COUNTOF(x) (sizeof(x) / sizeof(0[x])) +#else +template<typename T, size_t N> +constexpr inline size_t countof(const T(&)[N]) noexcept +{ return N; } +#define COUNTOF countof +#endif + #if defined(_WIN64) #define SZFMT "%I64u" #elif defined(_WIN32) @@ -197,8 +206,6 @@ static const union { #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1) #endif -#define COUNTOF(x) (sizeof(x) / sizeof(0[x])) - struct ll_ringbuffer; struct Hrtf; |