From 2665fabc56b07a80670ca4786050fecb9f1bd34a Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 20:49:33 +0000 Subject: [PATCH] refactor(gamememory): Improve clarity of memory fill loops --- Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp | 4 ++-- .../Code/GameEngine/Source/Common/System/GameMemory.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp b/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp index f760d6f470f..341f6983e87 100644 --- a/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp +++ b/Generals/Code/GameEngine/Source/Common/System/GameMemory.cpp @@ -303,11 +303,11 @@ static void memset32(void* ptr, Int value, Int bytesToFill) bytesToFill -= (wordsToFill<<2); Int *p = (Int*)ptr; - for (++wordsToFill; --wordsToFill; ) + while (wordsToFill-- > 0) *p++ = value; Byte *b = (Byte *)p; - for (++bytesToFill; --bytesToFill; ) + while (bytesToFill-- > 0) *b++ = (Byte)value; } diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp index 2b7d51f52bc..6c2acf1d28e 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/System/GameMemory.cpp @@ -283,11 +283,11 @@ static void memset32(void* ptr, Int value, Int bytesToFill) bytesToFill -= (wordsToFill<<2); Int *p = (Int*)ptr; - for (++wordsToFill; --wordsToFill; ) + while (wordsToFill-- > 0) *p++ = value; Byte *b = (Byte *)p; - for (++bytesToFill; --bytesToFill; ) + while (bytesToFill-- > 0) *b++ = (Byte)value; }