Avoid brancing in ToLower/UpperAsciiInvariant(char)
authorstephentoub <stoub@microsoft.com>
Wed, 14 Oct 2015 15:29:11 +0000 (11:29 -0400)
committerstephentoub <stoub@microsoft.com>
Wed, 14 Oct 2015 20:18:25 +0000 (16:18 -0400)
commitf5d7492c903eba3aaf4acd33dc4bdb553f23feb5
tree1727655b52edbecbb7825ec31b104f1415c44441
parentadccaa2c3b1d320a0c47df4c5481fd9dbff266ac
Avoid brancing in ToLower/UpperAsciiInvariant(char)

Rather than comparing the input char against 'A'/'a' and 'Z'/'z', we simply trim off all but the lower 7 bits and do a lookup into a precomputed table.  This is ~3-4x faster than the branching version.

Commit migrated from https://github.com/dotnet/coreclr/commit/4b8dadec3a89da8d9e4d12ad9b8b68b2cdc7fe91
src/coreclr/src/mscorlib/corefx/System/Globalization/TextInfo.cs