From 042050ef67a0d320469a6f8ca74bd8684ec4c409 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 29 Jan 2016 11:47:40 +0100 Subject: Added Google Benchmark library (nw) Included sample benchmark for eminline for native and noasm Made GoogleTest compile only if tests are compiled --- 3rdparty/benchmark/src/arraysize.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 3rdparty/benchmark/src/arraysize.h (limited to '3rdparty/benchmark/src/arraysize.h') 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 +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 +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_ -- cgit v1.2.3-70-g09d2