Lines Matching refs:RHS

144 void SmallPtrSetImplBase::CopyFrom(const SmallPtrSetImplBase &RHS) {
145 assert(&RHS != this && "Self-copy should be handled by the caller.");
147 if (isSmall() && RHS.isSmall())
148 assert(CurArraySize == RHS.CurArraySize &&
152 if (RHS.isSmall()) {
157 } else if (CurArraySize != RHS.CurArraySize) {
159 CurArray = (const void**)safe_malloc(sizeof(void*) * RHS.CurArraySize);
162 sizeof(void*) * RHS.CurArraySize);
167 CopyHelper(RHS);
170 void SmallPtrSetImplBase::CopyHelper(const SmallPtrSetImplBase &RHS) {
172 CurArraySize = RHS.CurArraySize;
175 std::copy(RHS.CurArray, RHS.EndPointer(), CurArray);
177 NumNonEmpty = RHS.NumNonEmpty;
178 NumTombstones = RHS.NumTombstones;
182 SmallPtrSetImplBase &&RHS) {
185 MoveHelper(SmallSize, std::move(RHS));
189 SmallPtrSetImplBase &&RHS) {
190 assert(&RHS != this && "Self-move should be handled by the caller.");
192 if (RHS.isSmall()) {
193 // Copy a small RHS rather than moving.
195 std::copy(RHS.CurArray, RHS.CurArray + RHS.NumNonEmpty, CurArray);
197 CurArray = RHS.CurArray;
198 RHS.CurArray = RHS.SmallArray;
202 CurArraySize = RHS.CurArraySize;
203 NumNonEmpty = RHS.NumNonEmpty;
204 NumTombstones = RHS.NumTombstones;
206 // Make the RHS small and empty.
207 RHS.CurArraySize = SmallSize;
208 assert(RHS.CurArray == RHS.SmallArray);
209 RHS.NumNonEmpty = 0;
210 RHS.NumTombstones = 0;
213 void SmallPtrSetImplBase::swap(SmallPtrSetImplBase &RHS) {
214 if (this == &RHS) return;
217 if (!this->isSmall() && !RHS.isSmall()) {
218 std::swap(this->CurArray, RHS.CurArray);
219 std::swap(this->CurArraySize, RHS.CurArraySize);
220 std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
221 std::swap(this->NumTombstones, RHS.NumTombstones);
227 // If only RHS is small, copy the small elements into LHS and move the pointer
228 // from LHS to RHS.
229 if (!this->isSmall() && RHS.isSmall()) {
230 assert(RHS.CurArray == RHS.SmallArray);
231 std::copy(RHS.CurArray, RHS.CurArray + RHS.NumNonEmpty, this->SmallArray);
232 std::swap(RHS.CurArraySize, this->CurArraySize);
233 std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
234 std::swap(this->NumTombstones, RHS.NumTombstones);
235 RHS.CurArray = this->CurArray;
240 // If only LHS is small, copy the small elements into RHS and move the pointer
241 // from RHS to LHS.
242 if (this->isSmall() && !RHS.isSmall()) {
245 RHS.SmallArray);
246 std::swap(RHS.CurArraySize, this->CurArraySize);
247 std::swap(RHS.NumNonEmpty, this->NumNonEmpty);
248 std::swap(RHS.NumTombstones, this->NumTombstones);
249 this->CurArray = RHS.CurArray;
250 RHS.CurArray = RHS.SmallArray;
255 assert(this->isSmall() && RHS.isSmall());
256 unsigned MinNonEmpty = std::min(this->NumNonEmpty, RHS.NumNonEmpty);
258 RHS.SmallArray);
262 RHS.SmallArray + MinNonEmpty);
264 std::copy(RHS.SmallArray + MinNonEmpty, RHS.SmallArray + RHS.NumNonEmpty,
267 assert(this->CurArraySize == RHS.CurArraySize);
268 std::swap(this->NumNonEmpty, RHS.NumNonEmpty);
269 std::swap(this->NumTombstones, RHS.NumTombstones);