OSDN Git Service

[yaml2obj] - Replace a loop with write_zeros(). NFCI.
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 29 Apr 2019 12:05:53 +0000 (12:05 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 29 Apr 2019 12:05:53 +0000 (12:05 +0000)
This looks better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359444 91177308-0d34-0410-b5e6-96231b3b80d8

tools/yaml2obj/yaml2elf.cpp

index e3246bc..ba07c9c 100644 (file)
@@ -40,8 +40,7 @@ class ContiguousBlobAccumulator {
       Align = 1;
     uint64_t CurrentOffset = InitialOffset + OS.tell();
     uint64_t AlignedOffset = alignTo(CurrentOffset, Align);
-    for (; CurrentOffset != AlignedOffset; ++CurrentOffset)
-      OS.write('\0');
+    OS.write_zeros(AlignedOffset - CurrentOffset);
     return AlignedOffset; // == CurrentOffset;
   }