qb  2.0.0.0
C++17 Actor Framework
qb Issue Watch Star Fork Follow @isndev
Loading...
Searching...
No Matches
branch_hints.h
Go to the documentation of this file.
1
25
26#ifndef QB_UTILS_BRANCH_HINTS_H
27#define QB_UTILS_BRANCH_HINTS_H
28
29namespace qb {
48inline bool
49likely(bool expr) {
50#ifdef __GNUC__
51 return __builtin_expect(expr, true);
52#else
53 return expr;
54#endif
55}
56
75inline bool
76unlikely(bool expr) {
77#ifdef __GNUC__
78 return __builtin_expect(expr, false);
79#else
80 return expr;
81#endif
82}
83
84} /* namespace qb */
85
86#endif /* QB_UTILS_BRANCH_HINTS_H */
bool unlikely(bool expr)
Hint for branch prediction when a condition is expected to be false.
Definition branch_hints.h:76
bool likely(bool expr)
Hint for branch prediction when a condition is expected to be true.
Definition branch_hints.h:49