[libcxx] r238828 - In the case where we are copying/moving zero elements, do less work

Marshall Clow mclow.lists at gmail.com
Tue Jun 2 06:04:19 PDT 2015


Author: marshall
Date: Tue Jun  2 08:04:18 2015
New Revision: 238828

URL: http://llvm.org/viewvc/llvm-project?rev=238828&view=rev
Log:
In the case where we are copying/moving zero elements, do less work

Modified:
    libcxx/trunk/include/memory

Modified: libcxx/trunk/include/memory
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/memory?rev=238828&r1=238827&r2=238828&view=diff
==============================================================================
--- libcxx/trunk/include/memory (original)
+++ libcxx/trunk/include/memory Tue Jun  2 08:04:18 2015
@@ -1522,8 +1522,10 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_t
         {
             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_t
             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>





More information about the cfe-commits mailing list