Skip to content

Commit 6ebfbf9

Browse files
committed
Make constant on GameVersion.TryFormatBytes style compare bittably equal
1 parent c7d7e43 commit 6ebfbf9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Management/GameVersion.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,16 @@ public readonly bool TryFormat(Span<char> destination, out int charsWritten, Rea
347347
/// </remarks>
348348
public readonly bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
349349
{
350+
const byte formatByteS = (byte)'s';
351+
const byte formatByteF = (byte)'f';
352+
const byte formatByteN = (byte)'n';
353+
350354
bytesWritten = 0;
351355

352-
bool isUseAutoFormat = !format.IsEmpty && (format[0] | 0x20) == 's'; // This compares both 's' or 'S' as true.
353-
bool isForceUseFullFormat = !format.IsEmpty && (format[0] | 0x20) == 'f'; // This compares both 'f' or 'F' as false.
356+
bool isUseAutoFormat = !format.IsEmpty && (format[0] | 0x20) == formatByteS; // This compares both 's' or 'S' as true.
357+
bool isForceUseFullFormat = !format.IsEmpty && (format[0] | 0x20) == formatByteF; // This compares both 'f' or 'F' as false.
354358
bool isUseMiniFormat = !isForceUseFullFormat &&
355-
(!format.IsEmpty && (format[0] | 0x20) == 'n' // This compares both 'n' or 'N' as true.
359+
(!format.IsEmpty && (format[0] | 0x20) == formatByteN // This compares both 'n' or 'N' as true.
356360
|| Revision == 0);
357361

358362
if (utf8Destination.Length < 4)

0 commit comments

Comments
 (0)