Invert 'if' statement to reduce nesting.

This commit is contained in:
2023-10-04 07:39:22 +01:00
parent a0a4124a26
commit 4ff79c804a
22 changed files with 447 additions and 449 deletions

View File

@@ -126,50 +126,50 @@ public sealed partial class NintendoPlugin
for(var i = 0; i < fields.FirstPartitions.Length; i++)
{
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 0)) << 2;
if(offset1 + i * 8 + 8 >= 0x50000)
continue;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4));
}
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 0)) << 2;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset1 + i * 8 + 4));
}
for(var i = 0; i < fields.SecondPartitions.Length; i++)
{
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 0)) << 2;
if(offset1 + i * 8 + 8 >= 0x50000)
continue;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4));
}
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 0)) << 2;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset2 + i * 8 + 4));
}
for(var i = 0; i < fields.ThirdPartitions.Length; i++)
{
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 0)) << 2;
if(offset1 + i * 8 + 8 >= 0x50000)
continue;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4));
}
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 0)) << 2;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset3 + i * 8 + 4));
}
for(var i = 0; i < fields.FourthPartitions.Length; i++)
{
if(offset1 + i * 8 + 8 < 0x50000)
{
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 0)) << 2;
if(offset1 + i * 8 + 8 >= 0x50000)
continue;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4));
}
fields.FirstPartitions[i].Offset =
BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 0)) << 2;
fields.FirstPartitions[i].Type =
BigEndianBitConverter.ToUInt32(header, (int)(offset4 + i * 8 + 4));
}
fields.Region = header[0x4E000];