[llvm-commits] [llvm] r68304 - /llvm/branches/Apple/Dib/include/llvm/ADT/SmallVector.h
Bill Wendling
isanbard at gmail.com
Wed Apr 1 23:46:11 PDT 2009
Author: void
Date: Thu Apr 2 01:46:11 2009
New Revision: 68304
URL: http://llvm.org/viewvc/llvm-project?rev=68304&view=rev
Log:
--- Merging (from foreign repository) r67473 into '.':
U include/llvm/ADT/SmallVector.h
Fix PR3860 by correcting a predicate.
Modified:
llvm/branches/Apple/Dib/include/llvm/ADT/SmallVector.h
Modified: llvm/branches/Apple/Dib/include/llvm/ADT/SmallVector.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/ADT/SmallVector.h?rev=68304&r1=68303&r2=68304&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/ADT/SmallVector.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/ADT/SmallVector.h Thu Apr 2 01:46:11 2009
@@ -293,10 +293,11 @@
// Uninvalidate the iterator.
I = begin()+InsertElt;
- // If we already have this many elements in the collection, append the
- // dest elements at the end, then copy over the appropriate elements. Since
- // we already reserved space, we know that this won't reallocate the vector.
- if (size() >= NumToInsert) {
+ // If there are more elements between the insertion point and the end of the
+ // range than there are being inserted, we can use a simple approach to
+ // insertion. Since we already reserved space, we know that this won't
+ // reallocate the vector.
+ if (size_t(end()-I) >= NumToInsert) {
T *OldEnd = End;
append(End-NumToInsert, End);
@@ -341,10 +342,11 @@
// Uninvalidate the iterator.
I = begin()+InsertElt;
- // If we already have this many elements in the collection, append the
- // dest elements at the end, then copy over the appropriate elements. Since
- // we already reserved space, we know that this won't reallocate the vector.
- if (size() >= NumToInsert) {
+ // If there are more elements between the insertion point and the end of the
+ // range than there are being inserted, we can use a simple approach to
+ // insertion. Since we already reserved space, we know that this won't
+ // reallocate the vector.
+ if (size_t(end()-I) >= NumToInsert) {
T *OldEnd = End;
append(End-NumToInsert, End);
More information about the llvm-commits
mailing list