@@ -443,6 +443,7 @@ void ResetCtrl(CommonFields& common, size_t slot_size) {
443443 ctrl_t * ctrl = common.control ();
444444 static constexpr size_t kTwoGroupCapacity = 2 * Group::kWidth - 1 ;
445445 if (ABSL_PREDICT_TRUE (capacity <= kTwoGroupCapacity )) {
446+ if (IsSmallCapacity (capacity)) return ;
446447 std::memset (ctrl, static_cast <int8_t >(ctrl_t ::kEmpty ), Group::kWidth );
447448 std::memset (ctrl + capacity, static_cast <int8_t >(ctrl_t ::kEmpty ),
448449 Group::kWidth );
@@ -591,13 +592,14 @@ size_t FindNewPositionsAndTransferSlots(
591592
592593 const auto insert_slot = [&](void * slot) {
593594 size_t hash = policy.hash_slot (hash_fn, slot);
594- auto target = find_first_non_full (common, hash);
595+ FindInfo target =
596+ common.is_small () ? FindInfo{0 , 0 } : find_first_non_full (common, hash);
595597 SetCtrl (common, target.offset , H2 (hash), slot_size);
596598 policy.transfer_n (&common, SlotAddress (new_slots, target.offset , slot_size),
597599 slot, 1 );
598600 return target.probe_length ;
599601 };
600- if (old_capacity == 1 ) {
602+ if (IsSmallCapacity ( old_capacity) ) {
601603 if (common.size () == 1 ) insert_slot (old_slots);
602604 return 0 ;
603605 }
@@ -1343,8 +1345,6 @@ void SmallEmptyNonSooPrepareInsert(CommonFields& common,
13431345 const bool has_infoz = infoz.IsSampled ();
13441346 void * alloc = policy.get_char_alloc (common);
13451347
1346- // TODO(b/413062340): don't allocate control bytes for capacity 1 tables. We
1347- // don't use the control bytes in this case.
13481348 const auto [new_ctrl, new_slots] =
13491349 AllocBackingArray (common, policy, kNewCapacity , has_infoz, alloc);
13501350 common.set_control </* kGenerateSeed=*/ true >(new_ctrl);
0 commit comments