Skip to content

Commit 7d58c44

Browse files
committed
Use TChar..CastToUInt32
1 parent f9287b5 commit 7d58c44

File tree

1 file changed

+4
-4
lines changed
  • src/libraries/System.Private.CoreLib/src/System

1 file changed

+4
-4
lines changed

src/libraries/System.Private.CoreLib/src/System/Guid.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,12 +819,12 @@ private static byte DecodeByte<TChar>(TChar ch1, TChar ch2, ref uint invalidIfGr
819819
ReadOnlySpan<byte> lookup = HexConverter.CharToHexLookup;
820820
Debug.Assert(lookup.Length == 256);
821821

822-
int c1 = typeof(TChar) == typeof(byte) ? byte.CreateTruncating(ch1) : (int)Math.Min(TChar.CastToUInt32(ch1), 0x7F);
823-
uint upper = lookup[c1];
822+
uint c1 = typeof(TChar) == typeof(byte) ? TChar.CastToUInt32(ch1) : Math.Min(TChar.CastToUInt32(ch1), 0x7F);
823+
uint upper = lookup[(int)c1];
824824
invalidIfGreaterThan7F |= upper;
825825

826-
int c2 = typeof(TChar) == typeof(byte) ? byte.CreateTruncating(ch2) : (int)Math.Min(TChar.CastToUInt32(ch2), 0x7F);
827-
uint lower = lookup[c2];
826+
uint c2 = typeof(TChar) == typeof(byte) ? TChar.CastToUInt32(ch2) : Math.Min(TChar.CastToUInt32(ch2), 0x7F);
827+
uint lower = lookup[(int)c2];
828828
invalidIfGreaterThan7F |= lower;
829829

830830
return (byte)((upper << 4) | lower);

0 commit comments

Comments
 (0)