Skip to content

Commit

Permalink
Auto-generate files after cl/703295900
Browse files Browse the repository at this point in the history
  • Loading branch information
protobuf-team-bot committed Dec 6, 2024
1 parent 9f29f02 commit 0b185ad
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
14 changes: 13 additions & 1 deletion php/ext/google/protobuf/php-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ Error, UINTPTR_MAX is undefined
#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
Expand Down Expand Up @@ -6133,7 +6144,7 @@ const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
if (num == number) {
return &base[mid];
}
if (num < number) {
if (UPB_UNPREDICTABLE(num < number)) {
lo = lo_mid;
} else {
hi = hi_mid;
Expand Down Expand Up @@ -17309,6 +17320,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
#undef UPB_MALLOC_ALIGN
#undef UPB_LIKELY
#undef UPB_UNLIKELY
#undef UPB_UNPREDICTABLE
#undef UPB_FORCEINLINE
#undef UPB_NOINLINE
#undef UPB_NORETURN
Expand Down
12 changes: 12 additions & 0 deletions php/ext/google/protobuf/php-upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,17 @@ Error, UINTPTR_MAX is undefined
#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
Expand Down Expand Up @@ -15702,6 +15713,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
#undef UPB_MALLOC_ALIGN
#undef UPB_LIKELY
#undef UPB_UNLIKELY
#undef UPB_UNPREDICTABLE
#undef UPB_FORCEINLINE
#undef UPB_NOINLINE
#undef UPB_NORETURN
Expand Down
14 changes: 13 additions & 1 deletion ruby/ext/google/protobuf_c/ruby-upb.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,17 @@ Error, UINTPTR_MAX is undefined
#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
Expand Down Expand Up @@ -6133,7 +6144,7 @@ const upb_MiniTableField* upb_MiniTable_FindFieldByNumber(
if (num == number) {
return &base[mid];
}
if (num < number) {
if (UPB_UNPREDICTABLE(num < number)) {
lo = lo_mid;
} else {
hi = hi_mid;
Expand Down Expand Up @@ -16796,6 +16807,7 @@ upb_ServiceDef* _upb_ServiceDefs_New(upb_DefBuilder* ctx, int n,
#undef UPB_MALLOC_ALIGN
#undef UPB_LIKELY
#undef UPB_UNLIKELY
#undef UPB_UNPREDICTABLE
#undef UPB_FORCEINLINE
#undef UPB_NOINLINE
#undef UPB_NORETURN
Expand Down
12 changes: 12 additions & 0 deletions ruby/ext/google/protobuf_c/ruby-upb.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@ Error, UINTPTR_MAX is undefined
#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
Expand Down Expand Up @@ -15515,6 +15526,7 @@ upb_MethodDef* _upb_MethodDefs_New(upb_DefBuilder* ctx, int n,
#undef UPB_MALLOC_ALIGN
#undef UPB_LIKELY
#undef UPB_UNLIKELY
#undef UPB_UNPREDICTABLE
#undef UPB_FORCEINLINE
#undef UPB_NOINLINE
#undef UPB_NORETURN
Expand Down

0 comments on commit 0b185ad

Please sign in to comment.