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; }