Improve performance when padding: don't write a byte at a time.

This commit is contained in:
Anthony J. Bentley
2014-02-08 23:26:43 -07:00
parent 0f488b6759
commit 17192ea6f0

View File

@@ -390,12 +390,11 @@ main(int argc, char *argv[])
headbyte++;
}
while (newsize != ftell(rom)) /* ROM needs resizing */
fputc(padvalue, rom);
if (newsize > 0x800000) /* ROM is bigger than 8MiB */
fprintf(stderr, "ROM size is bigger than 8MiB\n");
ftruncate(fileno(rom), newsize);
fseek(rom, 0x148, SEEK_SET);
fputc(headbyte, rom);
}