Skip to content
Snippets Groups Projects
Commit 361909e3 authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

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

parent 1ee1785b
No related branches found
No related tags found
No related merge requests found
...@@ -562,3 +562,13 @@ typedef double mp_float_t; ...@@ -562,3 +562,13 @@ typedef double mp_float_t;
#ifndef MP_WEAK #ifndef MP_WEAK
#define MP_WEAK __attribute__((weak)) #define MP_WEAK __attribute__((weak))
#endif #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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment