From 46223c8620c98be44628037e0a21c56182bf4f64 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 19 Dec 2023 10:19:12 -0800 Subject: Refactor `EraseMetaOnly` to speed up single group tables. PiperOrigin-RevId: 592272653 Change-Id: I895c5786555227bdc88ab0a4cce8cf5ba65222a1 --- absl/container/internal/raw_hash_set.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'absl/container/internal/raw_hash_set.h') diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 3b3c5aa3..b7295c84 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -1788,7 +1788,7 @@ void ClearBackingArray(CommonFields& c, const PolicyFunctions& policy, bool reuse); // Type-erased version of raw_hash_set::erase_meta_only. -void EraseMetaOnly(CommonFields& c, ctrl_t* it, size_t slot_size); +void EraseMetaOnly(CommonFields& c, size_t index, size_t slot_size); // Function to place in PolicyFunctions::dealloc for raw_hash_sets // that are using std::allocator. This allows us to share the same @@ -2871,7 +2871,8 @@ class raw_hash_set { // This merely updates the pertinent control byte. This can be used in // conjunction with Policy::transfer to move the object to another place. void erase_meta_only(const_iterator it) { - EraseMetaOnly(common(), it.control(), sizeof(slot_type)); + EraseMetaOnly(common(), static_cast(it.control() - control()), + sizeof(slot_type)); } // Resizes table to the new capacity and move all elements to the new -- cgit v1.2.3