public static Rune ToLowerInvariant(Rune value) { // Handle the most common case (ASCII data) first. Within the common case, we expect // that there'll be a mix of lowercase & uppercase chars, so make the conversion branchless. if (value.IsAscii || GlobalizationMode.Invariant) { // It's ok for us to use the UTF-16 conversion utility for this since the high // 16 bits of the value will never be set so will be left unchanged. return(UnsafeCreate(Utf16Utility.ConvertAllAsciiCharsInUInt32ToLowercase(value._value))); } // Non-ASCII data requires going through the case folding tables. return(ToLower(value, CultureInfo.InvariantCulture)); }
public static Rune ToLowerInvariant(Rune value) { // Handle the most common case (ASCII data) first. Within the common case, we expect // that there'll be a mix of lowercase & uppercase chars, so make the conversion branchless. if (value.IsAscii) { // It's ok for us to use the UTF-16 conversion utility for this since the high // 16 bits of the value will never be set so will be left unchanged. return(UnsafeCreate(Utf16Utility.ConvertAllAsciiCharsInUInt32ToLowercase(value._value))); } if (GlobalizationMode.Invariant) { // If the value isn't ASCII and if the globalization tables aren't available, // case changing has no effect. return(value); } // Non-ASCII data requires going through the case folding tables. return(ChangeCaseCultureAware(value, TextInfo.Invariant, toUpper: false)); }