Commit 70af93e9 by Abseil Team Committed by Copybara-Service

`AbslHashValue()` applied to a C-style array simply decays the array to a…

`AbslHashValue()` applied to a C-style array simply decays the array to a pointer and hashes that, which is very unlikely to be what the author intended.

PiperOrigin-RevId: 525923741
Change-Id: I876dbde341f0b0642fa3d10e3f67b0b31d0311bf
parent f8bf9091
...@@ -411,7 +411,7 @@ AbslHashValue(H hash_state, LongDouble value) { ...@@ -411,7 +411,7 @@ AbslHashValue(H hash_state, LongDouble value) {
// AbslHashValue() for hashing pointers // AbslHashValue() for hashing pointers
template <typename H, typename T> template <typename H, typename T>
H AbslHashValue(H hash_state, T* ptr) { H AbslHashValue(H hash_state, T* ptr) {
auto v = reinterpret_cast<uintptr_t>(ptr); auto v = reinterpret_cast<uintptr_t>(ptr);
// Due to alignment, pointers tend to have low bits as zero, and the next few // Due to alignment, pointers tend to have low bits as zero, and the next few
// bits follow a pattern since they are also multiples of some base value. // bits follow a pattern since they are also multiples of some base value.
......
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