From 789c17651725885daa2a2212f620caa81702dbf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 13 Mar 2018 23:13:59 +0100 Subject: [PATCH] Update common header --- src/openrct2/common.h | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/src/openrct2/common.h b/src/openrct2/common.h index 77247c720e..1485234453 100644 --- a/src/openrct2/common.h +++ b/src/openrct2/common.h @@ -23,17 +23,16 @@ #undef M_PI #ifdef _MSC_VER -#include +#include #endif -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include using sint8 = int8_t; using sint16 = int16_t; @@ -92,31 +91,6 @@ using colour_t = uint8; // Rounds an integer up to the given power of 2. y must be a power of 2. #define ceil2(x, y) (((x) + (y) - 1) & (~((y) - 1))) - -#ifndef __cplusplus -// in C++ you should be using Util::CountOf -#ifdef __GNUC__ -/** - * Force a compilation error if condition is true, but also produce a - * result (of value 0 and type size_t), so the expression can be used - * e.g. in a structure initializer (or where-ever else comma expressions - * aren't permitted). - */ -#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { sint32:-!!(e); })) - -/* &a[0] degrades to a pointer: a different type from an array */ -#define __must_be_array(a) \ - BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) - -// based on http://lxr.free-electrons.com/source/include/linux/kernel.h#L54 -#define countof(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) -#elif defined (_MSC_VER) -#define countof(arr) _countof(arr) -#else -#define countof(arr) (sizeof(arr) / sizeof((arr)[0])) -#endif // __GNUC__ -#endif // __cplusplus - // Gets the name of a symbol as a C string #define nameof(symbol) #symbol