From 401285b2f16f3eb098a9306e59b803f4ae9891bc Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Tue, 30 Jul 2019 20:02:28 -0700 Subject: Use UPB_LIKELY only when GNUC --- upb/port_def.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/upb/port_def.inc b/upb/port_def.inc index 0650920..3e0a7f4 100644 --- a/upb/port_def.inc +++ b/upb/port_def.inc @@ -52,7 +52,13 @@ #endif /* Hints to the compiler about likely/unlikely branches. */ +#ifdef __GNUC__ #define UPB_LIKELY(x) __builtin_expect((x),1) +#define UPB_UNLIKELY(x) __builtin_expect((x),0) +#else +#define UPB_LIKELY(x) (x) +#define UPB_UNLIKELY(x) (x) +#endif /* Define UPB_BIG_ENDIAN manually if you're on big endian and your compiler * doesn't provide these preprocessor symbols. */ -- cgit v1.2.3