mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-25 15:30:14 +00:00
Common: Add likely() and unlikely() macros to hint likeliness of taking a branch.
The compiled can use these hints to generate the code closer or further from the entry point depending on likeliness of taking a branch, this helps when entering the function without prior branch prediction, and on CPUs without proper branch prediction.
This commit is contained in:
parent
722af0703e
commit
d909f18195
@ -29,6 +29,14 @@
|
|||||||
#define FORCE_INLINE inline __attribute__((always_inline))
|
#define FORCE_INLINE inline __attribute__((always_inline))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define likely(x) __builtin_expect(!!(x), 1)
|
||||||
|
#define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
|
#else
|
||||||
|
#define likely(x) (x)
|
||||||
|
#define unlikely(x) (x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#ifdef ARCHITECTURE_x86_64
|
||||||
|
Loading…
Reference in New Issue
Block a user