| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Diagnostics; |
| | | 5 | | using System.Runtime.CompilerServices; |
| | | 6 | | using System.Text; |
| | | 7 | | |
| | | 8 | | namespace System.Globalization |
| | | 9 | | { |
| | | 10 | | internal static class SurrogateCasing |
| | | 11 | | { |
| | | 12 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 13 | | internal static void ToUpper(char h, char l, out char hr, out char lr) |
| | | 14 | | { |
| | 0 | 15 | | Debug.Assert(char.IsHighSurrogate(h)); |
| | 0 | 16 | | Debug.Assert(char.IsLowSurrogate(l)); |
| | | 17 | | |
| | 0 | 18 | | UnicodeUtility.GetUtf16SurrogatesFromSupplementaryPlaneScalar(CharUnicodeInfo.ToUpper(UnicodeUtility.GetScal |
| | | 19 | | |
| | 0 | 20 | | Debug.Assert(char.IsHighSurrogate(hr)); |
| | 0 | 21 | | Debug.Assert(char.IsLowSurrogate(lr)); |
| | 0 | 22 | | } |
| | | 23 | | |
| | | 24 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 25 | | internal static void ToLower(char h, char l, out char hr, out char lr) |
| | | 26 | | { |
| | 0 | 27 | | Debug.Assert(char.IsHighSurrogate(h)); |
| | 0 | 28 | | Debug.Assert(char.IsLowSurrogate(l)); |
| | | 29 | | |
| | 0 | 30 | | UnicodeUtility.GetUtf16SurrogatesFromSupplementaryPlaneScalar(CharUnicodeInfo.ToLower(UnicodeUtility.GetScal |
| | | 31 | | |
| | 0 | 32 | | Debug.Assert(char.IsHighSurrogate(hr)); |
| | 0 | 33 | | Debug.Assert(char.IsLowSurrogate(lr)); |
| | 0 | 34 | | } |
| | | 35 | | |
| | | 36 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 37 | | internal static bool Equal(char h1, char l1, char h2, char l2) |
| | | 38 | | { |
| | 0 | 39 | | ToUpper(h1, l1, out char hr1, out char lr1); |
| | 0 | 40 | | ToUpper(h2, l2, out char hr2, out char lr2); |
| | | 41 | | |
| | 0 | 42 | | return hr1 == hr2 && lr1 == lr2; |
| | | 43 | | } |
| | | 44 | | } |
| | | 45 | | } |
| | | 46 | | |