From 08a4176418e122509489fa4e87e9d47b53d7b750 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 1 Jan 2021 01:47:40 +0100 Subject: [PATCH] Improve file reading speeds by using an aligned buffer --- src/fs/FSUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fs/FSUtils.cpp b/src/fs/FSUtils.cpp index c51a254..885318a 100644 --- a/src/fs/FSUtils.cpp +++ b/src/fs/FSUtils.cpp @@ -20,13 +20,13 @@ int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_ uint32_t filesize = lseek(iFd, 0, SEEK_END); lseek(iFd, 0, SEEK_SET); - uint8_t *buffer = (uint8_t *) malloc(filesize); + uint8_t *buffer = (uint8_t *) memalign(0x40, filesize); if (buffer == NULL) { close(iFd); return -2; } - uint32_t blocksize = 0x4000; + uint32_t blocksize = 0x100000; uint32_t done = 0; int32_t readBytes = 0;