mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
common: add unlikely()/likely() macros
This commit is contained in:
parent
af8febabd1
commit
b9b8b0521b
@ -87,6 +87,16 @@ typedef uint64_t longtime_t;
|
||||
#define NORETURN
|
||||
#endif
|
||||
|
||||
#if defined(__has_builtin)
|
||||
#if __has_builtin(__builtin_expect)
|
||||
#define unlikely(x) __builtin_expect(x, 0)
|
||||
#define likely(x) __builtin_expect(x, 1)
|
||||
#else // __has_builtin(__builtin_expect)
|
||||
#define unlikely(x) (x)
|
||||
#define likely(x) (x)
|
||||
#endif // __has_builtin(__builtin_expect)
|
||||
#endif // defined(__has_builtin)
|
||||
|
||||
|
||||
#ifdef XASH_BIG_ENDIAN
|
||||
#define LittleLong(x) (((int)(((x)&255)<<24)) + ((int)((((x)>>8)&255)<<16)) + ((int)(((x)>>16)&255)<<8) + (((x) >> 24)&255))
|
||||
|
Loading…
x
Reference in New Issue
Block a user