aboutsummaryrefslogtreecommitdiff
path: root/absl/hash/internal/spy_hash_state.h
diff options
context:
space:
mode:
authorBenjamin Barenblat <bbaren@google.com>2024-09-03 11:49:29 -0400
committerBenjamin Barenblat <bbaren@google.com>2024-09-03 11:49:29 -0400
commitc1afa8b8238c25591ca80d068477aa7d4ce05fc8 (patch)
tree284a9f8b319de5783ff83ad004a9e390cb60fd0d /absl/hash/internal/spy_hash_state.h
parent23778b53f420f54eebc195dd8430e79bda165e5b (diff)
parent4447c7562e3bc702ade25105912dce503f0c4010 (diff)
downloadabseil-c1afa8b8238c25591ca80d068477aa7d4ce05fc8.tar.gz
abseil-c1afa8b8238c25591ca80d068477aa7d4ce05fc8.tar.bz2
abseil-c1afa8b8238c25591ca80d068477aa7d4ce05fc8.zip
Merge new upstream LTS 20240722.0
Diffstat (limited to 'absl/hash/internal/spy_hash_state.h')
-rw-r--r--absl/hash/internal/spy_hash_state.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/absl/hash/internal/spy_hash_state.h b/absl/hash/internal/spy_hash_state.h
index 09728266..357c301c 100644
--- a/absl/hash/internal/spy_hash_state.h
+++ b/absl/hash/internal/spy_hash_state.h
@@ -149,20 +149,20 @@ class SpyHashStateImpl : public HashStateBase<SpyHashStateImpl<T>> {
const unsigned char* begin,
size_t size) {
const size_t large_chunk_stride = PiecewiseChunkSize();
- if (size > large_chunk_stride) {
- // Combining a large contiguous buffer must have the same effect as
- // doing it piecewise by the stride length, followed by the (possibly
- // empty) remainder.
- while (size >= large_chunk_stride) {
- hash_state = SpyHashStateImpl::combine_contiguous(
- std::move(hash_state), begin, large_chunk_stride);
- begin += large_chunk_stride;
- size -= large_chunk_stride;
- }
+ // Combining a large contiguous buffer must have the same effect as
+ // doing it piecewise by the stride length, followed by the (possibly
+ // empty) remainder.
+ while (size > large_chunk_stride) {
+ hash_state = SpyHashStateImpl::combine_contiguous(
+ std::move(hash_state), begin, large_chunk_stride);
+ begin += large_chunk_stride;
+ size -= large_chunk_stride;
}
- hash_state.hash_representation_.emplace_back(
- reinterpret_cast<const char*>(begin), size);
+ if (size > 0) {
+ hash_state.hash_representation_.emplace_back(
+ reinterpret_cast<const char*>(begin), size);
+ }
return hash_state;
}