From: Kevin Day Date: Mon, 20 Apr 2020 04:44:28 +0000 (-0500) Subject: Update: memory simple delete and simple destroy loop tweaks X-Git-Tag: 0.5.0~354 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=0bb6ed1f82a1c3509452270a4980557e8d7a0346;p=fll Update: memory simple delete and simple destroy loop tweaks Move the conditional outside of the loop for theoretical performance improvements. --- diff --git a/level_0/f_memory/c/memory.h b/level_0/f_memory/c/memory.h index be48631..c023461 100644 --- a/level_0/f_memory/c/memory.h +++ b/level_0/f_memory/c/memory.h @@ -397,10 +397,10 @@ extern "C" { while (structures.used > 0) { \ structures.used--; \ f_macro_memory_structure_delete_simple(structures.array[structures.used], type); \ - if (structures.used == 0) { \ - if (f_memory_delete((void **) & structures.array, sizeof(type), structures.size)) { \ - structures.size = 0; \ - } \ + } \ + if (structures.used == 0) { \ + if (f_memory_delete((void **) & structures.array, sizeof(type), structures.size)) { \ + structures.size = 0; \ } \ } #endif // _di_f_macro_memory_structures_delete_simple_ @@ -417,10 +417,10 @@ extern "C" { while (structures.used > 0) { \ structures.used--; \ f_macro_memory_structure_destroy_simple(structures.array[structures.used], type); \ - if (structures.used == 0) { \ - if (f_memory_destroy((void **) & structures.array, sizeof(type), structures.size)) { \ - structures.size = 0; \ - } \ + } \ + if (structures.used == 0) { \ + if (f_memory_destroy((void **) & structures.array, sizeof(type), structures.size)) { \ + structures.size = 0; \ } \ } #endif // _di_f_macro_memory_structures_destroy_simple_