py: Add MP_LIKELY(), MP_UNLIKELY() macros to help branch prediction.
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 1700332..76f31e4 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -562,3 +562,13 @@
#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