@@ -1096,28 +1096,6 @@ namespace hud
10961096 count_ = other.count_ ;
10971097 // Compute the free slot count before growing
10981098 free_slot_before_grow_ = max_slot_before_grow (max_slot_count_) - count_;
1099-
1100- if (count_ > 0 )
1101- {
1102- control_type *control_full_or_sentinel = other.control_ptr_ ;
1103- slot_type *slot_full_or_sentinel = other.slot_ptr_ ;
1104- while (control_full_or_sentinel != other.control_ptr_sentinel ())
1105- {
1106- // Compute the hash
1107- u64 hash {hasher_type {}(slot_full_or_sentinel->key ())};
1108- // Find H1 slot index
1109- u64 h1 {H1 (hash)};
1110- usize slot_index {find_first_empty_or_deleted (control_ptr_, max_slot_count_, h1)};
1111- // Save h2 in control h1 index
1112- control::set_h2 (control_ptr_, slot_index, H2 (hash), max_slot_count_);
1113- // Copy slot
1114- hud::memory::construct_object_at (slot_ptr_ + slot_index, *slot_full_or_sentinel);
1115-
1116- control_type *full_or_sentinel {control::skip_empty_or_deleted (control_full_or_sentinel + 1 )};
1117- slot_full_or_sentinel += full_or_sentinel - control_full_or_sentinel;
1118- control_full_or_sentinel = full_or_sentinel;
1119- }
1120- }
11211099 }
11221100 else // If we don't have enough memory
11231101 {
@@ -1141,30 +1119,31 @@ namespace hud
11411119 // Set control to empty ending with sentinel
11421120 hud::memory::set_memory (control_ptr_, control_size, empty_byte);
11431121 control_ptr_[max_slot_count_] = sentinel_byte;
1122+ }
11441123
1145- // If we have elements to copy, copy them
1146- if (count_ > 0 )
1124+ // If we have elements to copy, copy them
1125+ if (count_ > 0 )
1126+ {
1127+ control_type *control_full_or_sentinel = other.control_ptr_ ;
1128+ slot_type *slot_full_or_sentinel = other.slot_ptr_ ;
1129+ while (control_full_or_sentinel != other.control_ptr_sentinel ())
11471130 {
1148- control_type *control_full_or_sentinel = other.control_ptr_ ;
1149- slot_type *slot_full_or_sentinel = other.slot_ptr_ ;
1150- while (control_full_or_sentinel != other.control_ptr_sentinel ())
1151- {
1152- // Compute the hash
1153- u64 hash {hasher_type {}(slot_full_or_sentinel->key ())};
1154- // Find H1 slot index
1155- u64 h1 {H1 (hash)};
1156- usize slot_index {find_first_empty_or_deleted (control_ptr_, max_slot_count_, h1)};
1157- // Save h2 in control h1 index
1158- control::set_h2 (control_ptr_, slot_index, H2 (hash), max_slot_count_);
1159- // Copy slot
1160- hud::memory::construct_object_at (slot_ptr_ + slot_index, *slot_full_or_sentinel);
1131+ // Compute the hash
1132+ u64 hash {hasher_type {}(slot_full_or_sentinel->key ())};
1133+ // Find H1 slot index
1134+ u64 h1 {H1 (hash)};
1135+ usize slot_index {find_first_empty_or_deleted (control_ptr_, max_slot_count_, h1)};
1136+ // Save h2 in control h1 index
1137+ control::set_h2 (control_ptr_, slot_index, H2 (hash), max_slot_count_);
1138+ // Copy slot
1139+ hud::memory::construct_object_at (slot_ptr_ + slot_index, *slot_full_or_sentinel);
11611140
1162- control_type *full_or_sentinel {control::skip_empty_or_deleted (control_full_or_sentinel + 1 )};
1163- slot_full_or_sentinel += full_or_sentinel - control_full_or_sentinel;
1164- control_full_or_sentinel = full_or_sentinel;
1165- }
1141+ control_type *full_or_sentinel {control::skip_empty_or_deleted (control_full_or_sentinel + 1 )};
1142+ slot_full_or_sentinel += full_or_sentinel - control_full_or_sentinel;
1143+ control_full_or_sentinel = full_or_sentinel;
11661144 }
11671145 }
1146+
11681147 return *this ;
11691148 }
11701149
0 commit comments