Commit 7135ec61 by Alexander Ignatyev Committed by Copybara-Service

PR #1559: Fix comparison of integer expressions of different signedness warning

Imported from GitHub PR https://github.com/abseil/abseil-cpp/pull/1559

```
//absl/hash/internal/hash.h:633:21: error: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Werror=sign-compare]
```

This warning is specific to the hashing of `std::bitset<>` on Big Endian platforms such as s390x

Merge 3f34d808c8689ffa47a798112ab44c0e3b32faa4 into 065d50d9

Merging this change closes #1559

COPYBARA_INTEGRATE_REVIEW=https://github.com/abseil/abseil-cpp/pull/1559 from aligusnet:20211102.0-mongo 3f34d808c8689ffa47a798112ab44c0e3b32faa4
PiperOrigin-RevId: 578897545
Change-Id: Ifd1c947af3ad01e8e2a6241030ed29fb00842d53
parent 065d50d9
......@@ -818,7 +818,7 @@ AbslHashValue(H hash_state, const absl::variant<T...>& v) {
template <typename H, size_t N>
H AbslHashValue(H hash_state, const std::bitset<N>& set) {
typename H::AbslInternalPiecewiseCombiner combiner;
for (int i = 0; i < N; i++) {
for (size_t i = 0; i < N; i++) {
unsigned char c = static_cast<unsigned char>(set[i]);
hash_state = combiner.add_buffer(std::move(hash_state), &c, sizeof(c));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment