Improve throughput of {U}Int32/64.{Try}Parse for hex (dotnet/coreclr#18952)
authorStephen Toub <stoub@microsoft.com>
Tue, 17 Jul 2018 13:00:11 +0000 (06:00 -0700)
committerGitHub <noreply@github.com>
Tue, 17 Jul 2018 13:00:11 +0000 (06:00 -0700)
commit70f529da79c51238c880c7a7e7be89b61a32a15f
treecdb646aef90b51f1ec4c2a3ba99d691b138f4208
parentdf446dc2f6b2b1208f69069c546b90817ab63931
Improve throughput of {U}Int32/64.{Try}Parse for hex (dotnet/coreclr#18952)

* Improve throughput of {U}Int32/64.{Try}Parse for hex

- Copies/modifies the recently added TryParse32/64IntegerStyle routines for hex in order to provide more optimized parsing.
- Since AllowHexSpecifier can't be used with any other styles (other than allowing leading/trailing whitespace), deletes existing code paths for parsing hex.
- As I was copying code around, I kept getting bitten by different names used for the same thing, so I also standardized some parameter names in various helper functions.

* Clean up

- Remove a bunch of unnecessary 'unsafe' keywords
- Rephrase some while(true) loops as do/while loops for consistency and to avoid some repetition
- Remove an unnecessary wrapper function

Commit migrated from https://github.com/dotnet/coreclr/commit/624f72d55a92e49aef3c3cd6e69150fa3b085fac
src/libraries/System.Private.CoreLib/src/System/Number.Parsing.cs