Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2824)

Unified Diff: Source/wtf/Vector.h

Issue 208253003: Simplify VectorMover<true, T>::swap() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/Vector.h
diff --git a/Source/wtf/Vector.h b/Source/wtf/Vector.h
index 99990367135d09854a297d3083d6f235cb4ca697..d9d0c7846257217a29619f484d72ab0333f0f1ed 100644
--- a/Source/wtf/Vector.h
+++ b/Source/wtf/Vector.h
@@ -160,14 +160,7 @@ static const size_t kInitialVectorSize = WTF_VECTOR_INITIAL_SIZE;
}
static void swap(T* src, T* srcEnd, T* dst)
{
- char* srcC = reinterpret_cast<char*>(src);
- char* srcEndC = reinterpret_cast<char*>(srcEnd);
- char* dstC = reinterpret_cast<char*>(dst);
-
- // FIXME: Below performs per-byte swap. This can be optimized by doing coarce-grained swap before-hand.
- size_t size = srcEndC - srcC;
- for (size_t i = 0; i < size; ++i)
- std::swap(srcC[i], dstC[i]);
+ std::swap_ranges(reinterpret_cast<char*>(src), reinterpret_cast<char*>(srcEnd), reinterpret_cast<char*>(dst));
}
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698