]> granicus.if.org Git - clang/commitdiff
Replace copy loops with memcpy.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 9 Mar 2010 12:53:38 +0000 (12:53 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 9 Mar 2010 12:53:38 +0000 (12:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98055 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/RecordLayout.cpp

index 9f8bdec94ee6c7ccca7e8268a63335a7766316b7..838753a1433facce01ab253c236028dd43c18425 100644 (file)
@@ -32,8 +32,7 @@ ASTRecordLayout::ASTRecordLayout(ASTContext &Ctx, uint64_t size, unsigned alignm
     FieldCount(fieldcount), CXXInfo(0) {
   if (FieldCount > 0)  {
     FieldOffsets = new (Ctx) uint64_t[FieldCount];
-    for (unsigned i = 0; i < FieldCount; ++i)
-      FieldOffsets[i] = fieldoffsets[i];
+    memcpy(FieldOffsets, fieldoffsets, FieldCount * sizeof(*FieldOffsets));
   }
 }
 
@@ -55,8 +54,7 @@ ASTRecordLayout::ASTRecordLayout(ASTContext &Ctx,
 {
   if (FieldCount > 0)  {
     FieldOffsets = new (Ctx) uint64_t[FieldCount];
-    for (unsigned i = 0; i < FieldCount; ++i)
-      FieldOffsets[i] = fieldoffsets[i];
+    memcpy(FieldOffsets, fieldoffsets, FieldCount * sizeof(*FieldOffsets));
   }
 
   CXXInfo->PrimaryBase = PrimaryBase;