0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-16 06:51:08 +01:00

ircd: Fix missing __has_builtin; minor cleanup.

This commit is contained in:
Jason Volk 2022-10-09 00:09:28 +00:00
parent df522ef8e9
commit 1f57c224c6

View file

@ -31,19 +31,27 @@
// Common branch prediction macros // Common branch prediction macros
// //
#ifndef likely #if !defined(likely)
#if __has_builtin(__builtin_expect)
#define likely(x) __builtin_expect(!!(x), 1) #define likely(x) __builtin_expect(!!(x), 1)
#else
#define likely(x) (x)
#endif
#endif #endif
#ifndef unlikely #if !defined(unlikely)
#if __has_builtin(__builtin_expect)
#define unlikely(x) __builtin_expect(!!(x), 0) #define unlikely(x) __builtin_expect(!!(x), 0)
#else
#define unlikely(x) (x)
#endif
#endif #endif
// //
// Assume // Assume
// //
#ifndef assume #if !defined(assume)
#if __has_builtin(__builtin_assume) #if __has_builtin(__builtin_assume)
#define assume(x) assert(x); __builtin_assume(x); #define assume(x) assert(x); __builtin_assume(x);
#else #else