|
12 | 12 | using Internal.Runtime.CompilerServices; |
13 | 13 | #endif |
14 | 14 |
|
15 | | -#pragma warning disable SA1121 // explicitly using type aliases instead of built-in types |
16 | | -#if SYSTEM_PRIVATE_CORELIB |
17 | | -#if TARGET_64BIT |
18 | | -using nuint_t = System.UInt64; |
19 | | -#else // TARGET_64BIT |
20 | | -using nuint_t = System.UInt32; |
21 | | -#endif // TARGET_64BIT |
22 | | -#else |
23 | | -using nuint_t = System.UInt64; |
24 | | -#endif |
25 | | - |
26 | 15 | namespace System.Text.Unicode |
27 | 16 | { |
28 | 17 | internal static unsafe partial class Utf16Utility |
29 | 18 | { |
30 | | -#if DEBUG && SYSTEM_PRIVATE_CORELIB |
31 | | - static Utf16Utility() |
32 | | - { |
33 | | - Debug.Assert(sizeof(nuint_t) == IntPtr.Size && nuint.MinValue == 0, "nuint_t is defined incorrectly."); |
34 | | - } |
35 | | -#endif // DEBUG && SYSTEM_PRIVATE_CORELIB |
36 | | - |
37 | 19 | // Returns &inputBuffer[inputLength] if the input buffer is valid. |
38 | 20 | /// <summary> |
39 | 21 | /// Given an input buffer <paramref name="pInputBuffer"/> of char length <paramref name="inputLength"/>, |
@@ -341,13 +323,13 @@ static Utf16Utility() |
341 | 323 | Vector<ushort> utf16Data = Unsafe.ReadUnaligned<Vector<ushort>>(pInputBuffer); |
342 | 324 | Vector<ushort> twoOrMoreUtf8Bytes = Vector.GreaterThanOrEqual(utf16Data, vector0080); |
343 | 325 | Vector<ushort> threeOrMoreUtf8Bytes = Vector.GreaterThanOrEqual(utf16Data, vector0800); |
344 | | - Vector<nuint_t> sumVector = (Vector<nuint_t>)(Vector<ushort>.Zero - twoOrMoreUtf8Bytes - threeOrMoreUtf8Bytes); |
| 326 | + Vector<nuint> sumVector = (Vector<nuint>)(Vector<ushort>.Zero - twoOrMoreUtf8Bytes - threeOrMoreUtf8Bytes); |
345 | 327 |
|
346 | 328 | // We'll try summing by a natural word (rather than a 16-bit word) at a time, |
347 | 329 | // which should halve the number of operations we must perform. |
348 | 330 |
|
349 | 331 | nuint popcnt = 0; |
350 | | - for (int i = 0; i < Vector<nuint_t>.Count; i++) |
| 332 | + for (int i = 0; i < Vector<nuint>.Count; i++) |
351 | 333 | { |
352 | 334 | popcnt += (nuint)sumVector[i]; |
353 | 335 | } |
|
0 commit comments