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:
parent
df522ef8e9
commit
1f57c224c6
1 changed files with 20 additions and 12 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue