From 42943eab954514e3bd53046140e9ea4cdb6e3577 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 26 Jun 2022 14:29:20 +0200 Subject: Removed blockempty call in freeProtection, as the call is slow, at the expanse of more memory that stay allocated for traking purpose, except when whole block is free --- src/custommem.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/custommem.c b/src/custommem.c index b2b5d6a5..02c371c9 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -1062,9 +1062,9 @@ void loadProtectionFromMap() static int blockempty(uint8_t* mem) { - uint32_t *p4 = (uint32_t*)mem; - for (int i=0; i<(MEMPROT_SIZE)/4; ++i, ++p4) - if(*p4) + uint64_t *p8 = (uint64_t*)mem; + for (int i=0; i<(MEMPROT_SIZE)/8; ++i, ++p8) + if(*p8) return 0; return 1; } @@ -1087,7 +1087,8 @@ void freeProtection(uintptr_t addr, size_t size) const uintptr_t finish = (((i|(MEMPROT_SIZE-1))