diff options
author | Vitaly Goldshteyn <goldvitaly@google.com> | 2024-03-04 13:12:48 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-03-04 13:13:36 -0800 |
commit | 8dc90ff07402cd027daec520bb77f46e51855889 (patch) | |
tree | bd9f651e2316b649dd24f4be2206af5590251e6a /absl/container/internal/raw_hash_set.cc | |
parent | 59daf188bcced05bbac02d71894e5ba4021597a6 (diff) | |
download | abseil-8dc90ff07402cd027daec520bb77f46e51855889.tar.gz abseil-8dc90ff07402cd027daec520bb77f46e51855889.tar.bz2 abseil-8dc90ff07402cd027daec520bb77f46e51855889.zip |
Extract `InsertPosition` function to be able to reuse it.
PiperOrigin-RevId: 612560213
Change-Id: Id75dfd1222a0bed8ec72ce21e4a97b1d09fc9eaa
Diffstat (limited to 'absl/container/internal/raw_hash_set.cc')
-rw-r--r-- | absl/container/internal/raw_hash_set.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/absl/container/internal/raw_hash_set.cc b/absl/container/internal/raw_hash_set.cc index 02301e19..efb3d6f3 100644 --- a/absl/container/internal/raw_hash_set.cc +++ b/absl/container/internal/raw_hash_set.cc @@ -104,10 +104,11 @@ bool CommonFieldsGenerationInfoEnabled::should_rehash_for_bug_detection_on_move( return ShouldRehashForBugDetection(ctrl, capacity); } -bool ShouldInsertBackwards(size_t hash, const ctrl_t* ctrl) { +bool ShouldInsertBackwardsForDebug(size_t capacity, size_t hash, + const ctrl_t* ctrl) { // To avoid problems with weak hashes and single bit tests, we use % 13. // TODO(kfm,sbenza): revisit after we do unconditional mixing - return (H1(hash, ctrl) ^ RandomSeed()) % 13 > 6; + return !is_small(capacity) && (H1(hash, ctrl) ^ RandomSeed()) % 13 > 6; } void ConvertDeletedToEmptyAndFullToDeleted(ctrl_t* ctrl, size_t capacity) { |