From 7116a804359a88bd244728c94cfb070e9d5616d7 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 19 Dec 2024 16:49:10 +1000 Subject: [PATCH] Common: Add RESTRICT macro Gotta coerce the compiler into generating better code. --- src/common/types.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/common/types.h b/src/common/types.h index 1328de8e3..85b7d3024 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -93,6 +93,13 @@ char (&__countof_ArraySizeHelper(T (&array)[N]))[N]; } while (0) #endif +// __restrict, potentially enables optimization by hinting the compiler that the object is unique. +#ifdef _MSC_VER +#define RESTRICT __restrict +#else +#define RESTRICT __restrict__ +#endif + // disable warnings that show up at warning level 4 // TODO: Move to build system instead #ifdef _MSC_VER