Auto-generate files after cl/703295900
diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index a1e1f06..fc6e6e0 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c
@@ -127,6 +127,17 @@ #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. #if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static @@ -6133,7 +6144,7 @@ if (num == number) { return &base[mid]; } - if (num < number) { + if (UPB_UNPREDICTABLE(num < number)) { lo = lo_mid; } else { hi = hi_mid; @@ -17309,6 +17320,7 @@ #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN
diff --git a/php/ext/google/protobuf/php-upb.h b/php/ext/google/protobuf/php-upb.h index 1047455..f775fe2 100644 --- a/php/ext/google/protobuf/php-upb.h +++ b/php/ext/google/protobuf/php-upb.h
@@ -126,6 +126,17 @@ #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. #if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static @@ -15702,6 +15713,7 @@ #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index a2a5c48..7ca943b 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -127,6 +127,17 @@ #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. #if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static @@ -6133,7 +6144,7 @@ if (num == number) { return &base[mid]; } - if (num < number) { + if (UPB_UNPREDICTABLE(num < number)) { lo = lo_mid; } else { hi = hi_mid; @@ -16796,6 +16807,7 @@ #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.h b/ruby/ext/google/protobuf_c/ruby-upb.h index ea668e0..ac37d78 100755 --- a/ruby/ext/google/protobuf_c/ruby-upb.h +++ b/ruby/ext/google/protobuf_c/ruby-upb.h
@@ -128,6 +128,17 @@ #define UPB_UNLIKELY(x) (x) #endif +#ifdef __has_builtin +#if __has_builtin(__builtin_expect_with_probability) +#define UPB_UNPREDICTABLE(x) \ + __builtin_expect_with_probability((bool)(x), 1, 0.5) +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif +#else +#define UPB_UNPREDICTABLE(x) (x) +#endif + // Macros for function attributes on compilers that support them. #if defined(__GNUC__) || defined(__clang__) #define UPB_FORCEINLINE __inline__ __attribute__((always_inline)) static @@ -15515,6 +15526,7 @@ #undef UPB_MALLOC_ALIGN #undef UPB_LIKELY #undef UPB_UNLIKELY +#undef UPB_UNPREDICTABLE #undef UPB_FORCEINLINE #undef UPB_NOINLINE #undef UPB_NORETURN