add likely/unlikely macros from linux kernel for future use

This commit is contained in:
Stanislav Shwartsman 2014-04-21 20:06:32 +00:00
parent 91047b893f
commit e03134d964

View File

@ -607,12 +607,28 @@ typedef
__attribute__ ((format (printf, formatArg, firstArg)))
#define BX_CPP_AttrNoReturn() __attribute__ ((noreturn))
#ifndef likely
#define likely(x) __builtin_expect(!!(x), 1)
#endif
#ifndef unlikely
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
#else
#define BX_CPP_AlignN(n) /* Not supported. */
#define BX_CPP_AttrPrintf(formatArg, firstArg) /* Not supported. */
#define BX_CPP_AttrNoReturn() /* Not supported. */
#ifndef likely
#define likely(x) (x)
#endif
#ifndef unlikely
#define unlikely(x) (x)
#endif
#endif
#define BX_GDBSTUB 0