Skip to content

Commit

Permalink
Mix pointers twice in TSan and MSVC to avoid flakes in the PointerAli…
Browse files Browse the repository at this point in the history
…gnment test.

PiperOrigin-RevId: 711817363
Change-Id: I873d11ad6e1a50fad6b8b3fb3671ad7446d1983b
  • Loading branch information
ezbr authored and copybara-github committed Jan 3, 2025
1 parent 6187f70 commit bdc9a7b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions absl/hash/internal/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ std::enable_if_t<std::is_pointer<T>::value, H> AbslHashValue(H hash_state,
// 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. The
// byte swap in WeakMix helps ensure we still have good entropy in low bits.
#if defined(__APPLE__) || defined(__ANDROID__) || \
defined(ABSL_HAVE_ADDRESS_SANITIZER)
#if defined(__APPLE__) || defined(__ANDROID__) || defined(_MSC_VER) || \
defined(ABSL_HAVE_ADDRESS_SANITIZER) || defined(ABSL_HAVE_THREAD_SANITIZER)
// In these build modes, pointers may have less entropy so mix pointers twice.
return H::combine(std::move(hash_state), v, v);
#endif
Expand Down

0 comments on commit bdc9a7b

Please sign in to comment.