Lines Matching full:rhs
163 const SmallPtrSetImplBase &RHS) {
164 assert(&RHS != this && "Self-copy should be handled by the caller.");
166 if (isSmall() && RHS.isSmall())
167 assert(CurArraySize == RHS.CurArraySize &&
171 if (RHS.isSmall()) {
177 } else if (CurArraySize != RHS.CurArraySize) {
179 CurArray = (const void**)safe_malloc(sizeof(void*) * RHS.CurArraySize);
182 sizeof(void*) * RHS.CurArraySize);
188 copyHelper(RHS);
191 void SmallPtrSetImplBase::copyHelper(const SmallPtrSetImplBase &RHS) {
193 CurArraySize = RHS.CurArraySize;
196 std::copy(RHS.CurArray, RHS.EndPointer(), CurArray);
198 NumNonEmpty = RHS.NumNonEmpty;
199 NumTombstones = RHS.NumTombstones;
205 SmallPtrSetImplBase &&RHS) {
208 moveHelper(SmallStorage, SmallSize, RHSSmallStorage, std::move(RHS));
214 SmallPtrSetImplBase &&RHS) {
215 assert(&RHS != this && "Self-move should be handled by the caller.");
217 if (RHS.isSmall()) {
218 // Copy a small RHS rather than moving.
220 std::copy(RHS.CurArray, RHS.CurArray + RHS.NumNonEmpty, CurArray);
222 CurArray = RHS.CurArray;
223 RHS.CurArray = RHSSmallStorage;
227 CurArraySize = RHS.CurArraySize;
228 NumNonEmpty = RHS.NumNonEmpty;
229 NumTombstones = RHS.NumTombstones;
230 IsSmall = RHS.IsSmall;
232 // Make the RHS small and empty.
233 RHS.CurArraySize = SmallSize;
234 RHS.NumNonEmpty = 0;
235 RHS.NumTombstones = 0;
236 RHS.IsSmall = true;
241 SmallPtrSetImplBase &RHS) {
242 if (this == &RHS) return;
245 if (!this->isSmall() && !RHS.isSmall()) {
246 std::swap(this->CurArray, RHS.CurArray);
247 std::swap(this->CurArraySize, RHS.CurArraySize);
248 std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
249 std::swap(this->NumTombstones, RHS.NumTombstones);
255 // If only RHS is small, copy the small elements into LHS and move the pointer
256 // from LHS to RHS.
257 if (!this->isSmall() && RHS.isSmall()) {
258 std::copy(RHS.CurArray, RHS.CurArray + RHS.NumNonEmpty, SmallStorage);
259 std::swap(RHS.CurArraySize, this->CurArraySize);
260 std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
261 std::swap(this->NumTombstones, RHS.NumTombstones);
262 RHS.CurArray = this->CurArray;
263 RHS.IsSmall = false;
269 // If only LHS is small, copy the small elements into RHS and move the pointer
270 // from RHS to LHS.
271 if (this->isSmall() && !RHS.isSmall()) {
274 std::swap(RHS.CurArraySize, this->CurArraySize);
275 std::swap(RHS.NumNonEmpty, this->NumNonEmpty);
276 std::swap(RHS.NumTombstones, this->NumTombstones);
277 this->CurArray = RHS.CurArray;
279 RHS.CurArray = RHSSmallStorage;
280 RHS.IsSmall = true;
285 assert(this->isSmall() && RHS.isSmall());
286 unsigned MinNonEmpty = std::min(this->NumNonEmpty, RHS.NumNonEmpty);
287 std::swap_ranges(this->CurArray, this->CurArray + MinNonEmpty, RHS.CurArray);
290 RHS.CurArray + MinNonEmpty);
292 std::copy(RHS.CurArray + MinNonEmpty, RHS.CurArray + RHS.NumNonEmpty,
295 assert(this->CurArraySize == RHS.CurArraySize);
296 std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
297 std::swap(this->NumTombstones, RHS.NumTombstones);