Skip to content

Commit 733069a

Browse files
ezbrcopybara-github
authored andcommitted
Refactor: move find_first_non_full into raw_hash_set.cc.
PiperOrigin-RevId: 781058935 Change-Id: Ia3e4284b0b6064517b653907159285e3a642aa4b
1 parent cf2b48c commit 733069a

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

absl/container/internal/raw_hash_set.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,18 @@ FindInfo find_first_non_full_from_h1(const ctrl_t* ctrl, size_t h1,
170170
}
171171
}
172172

173+
// Probes an array of control bits using a probe sequence derived from `hash`,
174+
// and returns the offset corresponding to the first deleted or empty slot.
175+
//
176+
// Behavior when the entire table is full is undefined.
177+
//
178+
// NOTE: this function must work with tables having both empty and deleted
179+
// slots in the same group. Such tables appear during `erase()`.
180+
FindInfo find_first_non_full(const CommonFields& common, size_t hash) {
181+
return find_first_non_full_from_h1(common.control(), H1(hash),
182+
common.capacity());
183+
}
184+
173185
// Whether a table fits in half a group. A half-group table fits entirely into a
174186
// probing group, i.e., has a capacity < `Group::kWidth`.
175187
//
@@ -246,11 +258,6 @@ void ConvertDeletedToEmptyAndFullToDeleted(ctrl_t* ctrl, size_t capacity) {
246258
ctrl[capacity] = ctrl_t::kSentinel;
247259
}
248260

249-
FindInfo find_first_non_full(const CommonFields& common, size_t hash) {
250-
return find_first_non_full_from_h1(common.control(), H1(hash),
251-
common.capacity());
252-
}
253-
254261
void IterateOverFullSlots(const CommonFields& c, size_t slot_size,
255262
absl::FunctionRef<void(const ctrl_t*, void*)> cb) {
256263
IterateOverFullSlotsImpl(c, slot_size, cb);

absl/container/internal/raw_hash_set.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,15 +1429,6 @@ inline probe_seq<Group::kWidth> probe(const CommonFields& common, size_t hash) {
14291429
return probe(common.capacity(), hash);
14301430
}
14311431

1432-
// Probes an array of control bits using a probe sequence derived from `hash`,
1433-
// and returns the offset corresponding to the first deleted or empty slot.
1434-
//
1435-
// Behavior when the entire table is full is undefined.
1436-
//
1437-
// NOTE: this function must work with tables having both empty and deleted
1438-
// slots in the same group. Such tables appear during `erase()`.
1439-
FindInfo find_first_non_full(const CommonFields& common, size_t hash);
1440-
14411432
constexpr size_t kProbedElementIndexSentinel = ~size_t{};
14421433

14431434
// Implementation detail of transfer_unprobed_elements_to_next_capacity_fn.

0 commit comments

Comments
 (0)