Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit dedca5a

Browse files
committed
Address PR feedback
1 parent 00099e0 commit dedca5a

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/System.Private.Uri/src/System/UriHelper.cs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -788,20 +788,16 @@ internal static bool IsLWS(char ch)
788788
return (ch <= ' ') && (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t');
789789
}
790790

791-
//Only consider ASCII characters
792791
internal static bool IsAsciiLetter(char character) =>
793-
((uint)(character - 'a') <= 'z' - 'a') ||
794-
((uint)(character - 'A') <= 'Z' - 'A');
792+
(((uint)character - 'A') & ~0x20) < 26;
795793

796794
internal static bool IsAsciiLetterOrDigit(char character) =>
797-
((uint)(character - 'a') <= 'z' - 'a') ||
798-
((uint)(character - 'A') <= 'Z' - 'A') ||
799-
((uint)(character - '0') <= '9' - '0');
795+
((((uint)character - 'A') & ~0x20) < 26) ||
796+
(((uint)character - '0') < 10);
800797

801798
internal static bool IsHexDigit(char character) =>
802-
((uint)(character - 'A') <= 'F' - 'A') ||
803-
((uint)(character - 'a') <= 'f' - 'a') ||
804-
((uint)(character - '0') <= '9' - '0');
799+
((((uint)character - 'A') & ~0x20) < 6) ||
800+
(((uint)character - '0') < 10);
805801

806802
//
807803
// Is this a Bidirectional control char.. These get stripped

0 commit comments

Comments
 (0)