diff options
author | Marshall Clow <mclow.lists@gmail.com> | 2015-06-02 13:04:18 +0000 |
---|---|---|
committer | Marshall Clow <mclow.lists@gmail.com> | 2015-06-02 13:04:18 +0000 |
commit | e62307421053f527e2837e7a4d1d3c246b39303f (patch) | |
tree | 623c244f324aee766ca2dd989dcce0b56458c4ec /libcxx | |
parent | 604de5c25610bed3ed2b107f6be9ca731f75721b (diff) | |
download | bcm5719-llvm-e62307421053f527e2837e7a4d1d3c246b39303f.tar.gz bcm5719-llvm-e62307421053f527e2837e7a4d1d3c246b39303f.zip |
In the case where we are copying/moving zero elements, do less work
llvm-svn: 238828
Diffstat (limited to 'libcxx')
-rw-r--r-- | libcxx/include/memory | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libcxx/include/memory b/libcxx/include/memory index 6f3fdd53ec3..4e3a6f814f1 100644 --- a/libcxx/include/memory +++ b/libcxx/include/memory @@ -1522,8 +1522,10 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits { ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) + { _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp)); - __begin2 += _Np; + __begin2 += _Np; + } } template <class _Iter, class _Ptr> @@ -1551,8 +1553,10 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits typedef typename remove_const<_Tp>::type _Vp; ptrdiff_t _Np = __end1 - __begin1; if (_Np > 0) + { _VSTD::memcpy(const_cast<_Vp*>(__begin2), __begin1, _Np * sizeof(_Tp)); - __begin2 += _Np; + __begin2 += _Np; + } } template <class _Ptr> |