[llvm-commits] [llvm] r152254 - /llvm/trunk/lib/Support/SmallPtrSet.cpp
Benjamin Kramer
benny.kra at googlemail.com
Wed Mar 7 14:48:42 PST 2012
Author: d0k
Date: Wed Mar 7 16:48:42 2012
New Revision: 152254
URL: http://llvm.org/viewvc/llvm-project?rev=152254&view=rev
Log:
Copy the right amount of elements.
Modified:
llvm/trunk/lib/Support/SmallPtrSet.cpp
Modified: llvm/trunk/lib/Support/SmallPtrSet.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/SmallPtrSet.cpp?rev=152254&r1=152253&r2=152254&view=diff
==============================================================================
--- llvm/trunk/lib/Support/SmallPtrSet.cpp (original)
+++ llvm/trunk/lib/Support/SmallPtrSet.cpp Wed Mar 7 16:48:42 2012
@@ -241,7 +241,8 @@
// If only RHS is small, copy the small elements into LHS and move the pointer
// from LHS to RHS.
if (!this->isSmall() && RHS.isSmall()) {
- std::copy(RHS.SmallArray, RHS.SmallArray+CurArraySize, this->SmallArray);
+ std::copy(RHS.SmallArray, RHS.SmallArray+RHS.CurArraySize,
+ this->SmallArray);
std::swap(this->NumElements, RHS.NumElements);
std::swap(this->CurArraySize, RHS.CurArraySize);
RHS.CurArray = this->CurArray;
@@ -254,7 +255,8 @@
// If only LHS is small, copy the small elements into RHS and move the pointer
// from RHS to LHS.
if (this->isSmall() && !RHS.isSmall()) {
- std::copy(this->SmallArray, this->SmallArray+CurArraySize, RHS.SmallArray);
+ std::copy(this->SmallArray, this->SmallArray+this->CurArraySize,
+ RHS.SmallArray);
std::swap(RHS.NumElements, this->NumElements);
std::swap(RHS.CurArraySize, this->CurArraySize);
this->CurArray = RHS.CurArray;
@@ -267,7 +269,7 @@
// Both a small, just swap the small elements.
assert(this->isSmall() && RHS.isSmall());
assert(this->CurArraySize == RHS.CurArraySize);
- std::swap_ranges(this->SmallArray, this->SmallArray+CurArraySize,
+ std::swap_ranges(this->SmallArray, this->SmallArray+this->CurArraySize,
RHS.SmallArray);
std::swap(this->NumElements, RHS.NumElements);
}
More information about the llvm-commits
mailing list