summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/benchmark/src/arraysize.h
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-02-21 11:35:58 +0100
committer ImJezze <jezze@gmx.net>2016-02-21 11:35:58 +0100
commitb5daabda5495dea5c50e17961ecfed2ea8619d76 (patch)
treef192bedcd7939c68d40a75a1901239be7f52de07 /3rdparty/benchmark/src/arraysize.h
parente57c90084c5d1dd9f6cdb0bbbf8782dc4f369cda (diff)
parentc24b31a077c2103b27e4df67d3be825c0c7d379d (diff)
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Resolved Conflicts: - src/osd/modules/render/d3d/d3dhlsl.cpp
Diffstat (limited to '3rdparty/benchmark/src/arraysize.h')
-rw-r--r--3rdparty/benchmark/src/arraysize.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/3rdparty/benchmark/src/arraysize.h b/3rdparty/benchmark/src/arraysize.h
new file mode 100644
index 00000000000..638a52a0ecb
--- /dev/null
+++ b/3rdparty/benchmark/src/arraysize.h
@@ -0,0 +1,34 @@
+#ifndef BENCHMARK_ARRAYSIZE_H_
+#define BENCHMARK_ARRAYSIZE_H_
+
+#include "internal_macros.h"
+
+namespace benchmark {
+namespace internal {
+// The arraysize(arr) macro returns the # of elements in an array arr.
+// The expression is a compile-time constant, and therefore can be
+// used in defining new arrays, for example. If you use arraysize on
+// a pointer by mistake, you will get a compile-time error.
+//
+
+
+// This template function declaration is used in defining arraysize.
+// Note that the function doesn't need an implementation, as we only
+// use its type.
+template <typename T, size_t N>
+char (&ArraySizeHelper(T (&array)[N]))[N];
+
+// That gcc wants both of these prototypes seems mysterious. VC, for
+// its part, can't decide which to use (another mystery). Matching of
+// template overloads: the final frontier.
+#ifndef COMPILER_MSVC
+template <typename T, size_t N>
+char (&ArraySizeHelper(const T (&array)[N]))[N];
+#endif
+
+#define arraysize(array) (sizeof(::benchmark::internal::ArraySizeHelper(array)))
+
+} // end namespace internal
+} // end namespace benchmark
+
+#endif // BENCHMARK_ARRAYSIZE_H_