diff --git a/src/google/protobuf/has_bits.h b/src/google/protobuf/has_bits.h index b90c450059..aae330b22a 100644 --- a/src/google/protobuf/has_bits.h +++ b/src/google/protobuf/has_bits.h @@ -71,7 +71,7 @@ class HasBits { } void Or(const HasBits& rhs) { - for (size_t i = 0; i < doublewords; i++) has_bits_[i] |= rhs[i]; + for (size_t i = 0; i < doublewords; i++) has_bits_[i] |= rhs.has_bits_[i]; } bool empty() const; diff --git a/src/google/protobuf/string_block.h b/src/google/protobuf/string_block.h index b105d57f3c..06f040bc9b 100644 --- a/src/google/protobuf/string_block.h +++ b/src/google/protobuf/string_block.h @@ -142,10 +142,11 @@ inline size_t StringBlock::NextSize(StringBlock* block) { } inline StringBlock* StringBlock::Emplace(void* p, size_t n, StringBlock* next) { - ABSL_DCHECK_EQ(n, NextSize(next)); - uint32_t doubled = static_cast(n) * 2; + const auto count = static_cast(n); + ABSL_DCHECK_EQ(count, NextSize(next)); + uint32_t doubled = count * 2; uint32_t next_size = next ? std::min(doubled, max_size()) : min_size(); - return new (p) StringBlock(next, false, RoundedSize(n), next_size); + return new (p) StringBlock(next, false, RoundedSize(count), next_size); } inline StringBlock* StringBlock::New(StringBlock* next) {