Fix RCS1239

This commit is contained in:
RoosterDragon
2023-03-18 13:25:08 +00:00
committed by Gustas
parent 64de28427c
commit fc0bdce151
2 changed files with 4 additions and 3 deletions

View File

@@ -1120,3 +1120,6 @@ dotnet_diagnostic.RCS1233.severity = warning
# Optimize method call. # Optimize method call.
dotnet_diagnostic.RCS1235.severity = warning dotnet_diagnostic.RCS1235.severity = warning
# Use 'for' statement instead of 'while' statement.
dotnet_diagnostic.RCS1239.severity = warning

View File

@@ -214,8 +214,7 @@ namespace OpenRA.Mods.Common.FileFormats
public int ReadBits(int count) public int ReadBits(int count)
{ {
var ret = 0; var ret = 0;
var filled = 0; for (var filled = 0; filled < count; filled++)
while (filled < count)
{ {
if (bitCount == 0) if (bitCount == 0)
{ {
@@ -226,7 +225,6 @@ namespace OpenRA.Mods.Common.FileFormats
ret |= (bitBuffer & 1) << filled; ret |= (bitBuffer & 1) << filled;
bitBuffer >>= 1; bitBuffer >>= 1;
bitCount--; bitCount--;
filled++;
} }
return ret; return ret;