From 41ed920d35885d85e2f3f56476a8900c424e21d0 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 9 Jun 2024 09:16:07 +0300 Subject: [PATCH] common: xash3d_types: fix build --- common/xash3d_types.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/xash3d_types.h b/common/xash3d_types.h index 05c9dbff..8457e1df 100644 --- a/common/xash3d_types.h +++ b/common/xash3d_types.h @@ -101,10 +101,17 @@ typedef uint64_t longtime_t; #define RENAME_SYMBOL( x ) #endif -#if ( __GNUC__ >= 3 ) || ( defined( __has_builtin ) && __has_builtin( __builtin_expect )) +#if __GNUC__ >= 3 #define unlikely( x ) __builtin_expect( x, 0 ) #define likely( x ) __builtin_expect( x, 1 ) -#else +#elif defined( __has_builtin ) + #if __has_builtin( __builtin_expect ) // this must be after defined() check + #define unlikely( x ) __builtin_expect( x, 0 ) + #define likely( x ) __builtin_expect( x, 1 ) + #endif +#endif + +#if !defined( unlikely ) || !defined( likely ) #define unlikely( x ) ( x ) #define likely( x ) ( x ) #endif