aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-14 06:17:47 -0800
committerChris Robinson <[email protected]>2018-11-14 06:17:47 -0800
commit46301a087cfa106979dd1bab5574737020c9f94f (patch)
treef19494ed4b8c532e54bc8319119dd8691f0922b5 /OpenAL32/Include
parent3021a426c027fb88bf13b36ad825b9686001a5c9 (diff)
Use C++ a bit more with alc.cpp
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alMain.h11
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;