py: Add MP_LIKELY(), MP_UNLIKELY() macros to help branch prediction.

pull/1028/head v1.3.8
Paul Sokolovsky 2014-12-29 00:51:06 +02:00
rodzic 1ee1785bed
commit 361909e3ca
1 zmienionych plików z 10 dodań i 0 usunięć

Wyświetl plik

@ -562,3 +562,13 @@ typedef double mp_float_t;
#ifndef MP_WEAK
#define MP_WEAK __attribute__((weak))
#endif
// Condition is likely to be true, to help branch prediction
#ifndef MP_LIKELY
#define MP_LIKELY(x) __builtin_expect((x), 1)
#endif
// Condition is likely to be false, to help branch prediction
#ifndef MP_UNLIKELY
#define MP_UNLIKELY(x) __builtin_expect((x), 0)
#endif