memgraph/include/utils/likely.hpp

11 lines
250 B
C++
Raw Normal View History

2015-10-28 03:21:28 +08:00
#pragma once
#if __GNUC__ >= 3
// make a hint for the branch predictor in a conditional or a loop
#define LIKELY(x) __builtin_expect(!!(x), 1)
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
#else
#define LIKELY(x) (x)
#define UNLIKELY(x) (x)
#endif