diff --git a/src/android.c b/src/android.c index 7ff7f26b527..034e1db2dd6 100644 --- a/src/android.c +++ b/src/android.c @@ -6158,8 +6158,6 @@ android_build_jstring (const char *text) if global_foo cannot be allocated, and after the global reference is created. */ -#define likely(cond) __builtin_expect (cond, 1) - /* Check for JNI exceptions and call memory_full in that situation. */ diff --git a/src/conf_post.h b/src/conf_post.h index e0bb753df56..74742ac16dc 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -371,6 +371,11 @@ extern int emacs_setenv_TZ (char const *); # define UNINIT /* empty */ #endif +/* likely (COND) is equivalent to COND ? 1 : 0, but instructs the + compiler to provide static branch prediction hints to the CPU so that + the branch isn't mispredicted. */ +#define likely(cond) __builtin_expect (!!(cond), 1) + /* Emacs needs neither glibc strftime behavior for AM and PM indicators, nor Gnulib strftime support for non-Gregorian calendars. */ #define REQUIRE_GNUISH_STRFTIME_AM_PM false