misc: define SPOT_LIKELY and SPOT_UNLIKELY
* src/misc/common.hh: Here. * src/misc/intvcmp2.cc, src/misc/intvcomp.cc: Adjust to use them.
This commit is contained in:
parent
923785f76a
commit
f0fd654c1f
3 changed files with 30 additions and 37 deletions
|
|
@ -23,6 +23,14 @@
|
|||
#ifndef SPOT_MISC_COMMON_HH
|
||||
# define SPOT_MISC_COMMON_HH
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define SPOT_LIKELY(expr) __builtin_expect(!!(expr), 1)
|
||||
#define SPOT_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
|
||||
#else
|
||||
#define SPOT_LIKELY(expr) (expr)
|
||||
#define SPOT_UNLIKELY(expr) (expr)
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define SPOT_DEPRECATED __attribute__ ((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue