From 2cccc0597f22ec90edf6317e123dc1a69bfe913d Mon Sep 17 00:00:00 2001 From: Franck STAUFFER Date: Sat, 16 Jan 2021 11:09:41 +0100 Subject: [PATCH] Small useless optimizations --- src/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 5131292..2381f75 100644 --- a/src/main.c +++ b/src/main.c @@ -154,7 +154,7 @@ init_SDL(const char* path) return 1; } -long +uint64_t get_file_size(FILE* f) { if (fseek(f, 0, SEEK_END)) { @@ -162,7 +162,7 @@ get_file_size(FILE* f) return 0; } - const long size = ftell(f); + const int64_t size = ftell(f); if (size == -1) { fputs("ERROR: Failed to get file size\n", stderr); return 0; @@ -182,7 +182,7 @@ load_rom(const char* path) return 0; } - const long size = get_file_size(f); + const uint64_t size = get_file_size(f); if (!size) { if (fclose(f)) fputs("ERROR: Failed to close rom file\n", stderr); @@ -214,7 +214,7 @@ load_rom(const char* path) fputs("Loaded ROM:\n", stderr); uint_fast8_t c = 0; - for (long t = 0; t < size; t += 2) { + for (register uint64_t t = 0; t < size; t += 2) { fprintf( stderr, "%04X ", (memory[t + 0x200] << 8) + memory[t + 0x200 + 1]); if (++c == 8) {