Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions absl/hash/internal/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,9 @@ AbslHashValue(H hash_state, const std::vector<T, Allocator>& vector) {
for (size_t j = 0; j < 64; ++j) {
word |= static_cast<uint64_t>(vector[i + j]) << j;
}
if constexpr (absl::endian::native == absl::endian::big) {
word = absl::byteswap(word);
}
hash_state = combiner.add_buffer(
std::move(hash_state), reinterpret_cast<const unsigned char*>(&word),
sizeof(word));
Expand All @@ -821,6 +824,9 @@ AbslHashValue(H hash_state, const std::vector<T, Allocator>& vector) {
for (size_t j = 0; j < rem; ++j) {
word |= static_cast<uint64_t>(vector[i + j]) << j;
}
if constexpr (absl::endian::native == absl::endian::big) {
word = absl::byteswap(word);
}
hash_state = combiner.add_buffer(
std::move(hash_state), reinterpret_cast<const unsigned char*>(&word),
(rem + 7) / 8);
Expand Down Expand Up @@ -988,6 +994,9 @@ H AbslHashValue(H hash_state, const std::bitset<N>& set) {
for (size_t j = 0; j < 64; ++j) {
word |= static_cast<uint64_t>(set[i + j]) << j;
}
if constexpr (absl::endian::native == absl::endian::big) {
word = absl::byteswap(word);
}
hash_state = combiner.add_buffer(
std::move(hash_state), reinterpret_cast<const unsigned char*>(&word),
sizeof(word));
Expand All @@ -1000,6 +1009,9 @@ H AbslHashValue(H hash_state, const std::bitset<N>& set) {
for (size_t j = 0; j < rem; ++j) {
word |= static_cast<uint64_t>(set[i + j]) << j;
}
if constexpr (absl::endian::native == absl::endian::big) {
word = absl::byteswap(word);
}
hash_state = combiner.add_buffer(
std::move(hash_state), reinterpret_cast<const unsigned char*>(&word),
(rem + 7) / 8);
Expand Down