Small useless optimizations

This commit is contained in:
Franck STAUFFER 2021-01-16 11:09:41 +01:00
parent 06b727cbc5
commit 2cccc0597f
Signed by: franck.stauffer
GPG Key ID: AAF5A94045CEC261
1 changed files with 4 additions and 4 deletions

View File

@ -154,7 +154,7 @@ init_SDL(const char* path)
return 1; return 1;
} }
long uint64_t
get_file_size(FILE* f) get_file_size(FILE* f)
{ {
if (fseek(f, 0, SEEK_END)) { if (fseek(f, 0, SEEK_END)) {
@ -162,7 +162,7 @@ get_file_size(FILE* f)
return 0; return 0;
} }
const long size = ftell(f); const int64_t size = ftell(f);
if (size == -1) { if (size == -1) {
fputs("ERROR: Failed to get file size\n", stderr); fputs("ERROR: Failed to get file size\n", stderr);
return 0; return 0;
@ -182,7 +182,7 @@ load_rom(const char* path)
return 0; return 0;
} }
const long size = get_file_size(f); const uint64_t size = get_file_size(f);
if (!size) { if (!size) {
if (fclose(f)) if (fclose(f))
fputs("ERROR: Failed to close rom file\n", stderr); fputs("ERROR: Failed to close rom file\n", stderr);
@ -214,7 +214,7 @@ load_rom(const char* path)
fputs("Loaded ROM:\n", stderr); fputs("Loaded ROM:\n", stderr);
uint_fast8_t c = 0; uint_fast8_t c = 0;
for (long t = 0; t < size; t += 2) { for (register uint64_t t = 0; t < size; t += 2) {
fprintf( fprintf(
stderr, "%04X ", (memory[t + 0x200] << 8) + memory[t + 0x200 + 1]); stderr, "%04X ", (memory[t + 0x200] << 8) + memory[t + 0x200 + 1]);
if (++c == 8) { if (++c == 8) {