From 293f0a3b31b9a3ea5d02cb6553d32909d660922b Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 30 Aug 2023 03:30:49 -0700 Subject: [PATCH] protobuf: mark unlikely branch as so Don't leave things to chance. We generally mark likely/unlikely branches on hot paths as such. PiperOrigin-RevId: 561288632 --- php/ext/google/protobuf/php-upb.c | 2 ++ ruby/ext/google/protobuf_c/ruby-upb.c | 2 ++ src/google/protobuf/serial_arena.h | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c index 640e5a4beb..67b9cfebfa 100644 --- a/php/ext/google/protobuf/php-upb.c +++ b/php/ext/google/protobuf/php-upb.c @@ -1,6 +1,8 @@ /* Amalgamated source file */ #include "php-upb.h" +test-xyz + /* * This is where we define internal portability macros used across upb. * diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c index 23be9a1249..7bf191aad2 100644 --- a/ruby/ext/google/protobuf_c/ruby-upb.c +++ b/ruby/ext/google/protobuf_c/ruby-upb.c @@ -1,6 +1,8 @@ /* Amalgamated source file */ #include "ruby-upb.h" +test-xyz + /* * This is where we define internal portability macros used across upb. * diff --git a/src/google/protobuf/serial_arena.h b/src/google/protobuf/serial_arena.h index 935aba522c..39ee2d3761 100644 --- a/src/google/protobuf/serial_arena.h +++ b/src/google/protobuf/serial_arena.h @@ -133,7 +133,7 @@ class PROTOBUF_EXPORT SerialArena { // the pattern we are looking for. const size_t index = absl::bit_width(size - 1) - 4; - if (index >= cached_block_length_) return nullptr; + if (PROTOBUF_PREDICT_FALSE(index >= cached_block_length_)) return nullptr; auto& cached_head = cached_blocks_[index]; if (cached_head == nullptr) return nullptr;