Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Latin1Utility.cs
Go to the documentation of this file.
6
7namespace System.Text;
8
9internal static class Latin1Utility
10{
11 [MethodImpl(MethodImplOptions.AggressiveInlining)]
12 public unsafe static nuint GetIndexOfFirstNonLatin1Char(char* pBuffer, nuint bufferLength)
13 {
14 if (!Sse2.IsSupported)
15 {
16 return GetIndexOfFirstNonLatin1Char_Default(pBuffer, bufferLength);
17 }
18 return GetIndexOfFirstNonLatin1Char_Sse2(pBuffer, bufferLength);
19 }
20
21 private unsafe static nuint GetIndexOfFirstNonLatin1Char_Default(char* pBuffer, nuint bufferLength)
22 {
23 char* ptr = pBuffer;
24 if (Vector.IsHardwareAccelerated && bufferLength >= (uint)(2 * Vector<ushort>.Count))
25 {
26 uint count = (uint)Vector<ushort>.Count;
27 uint count2 = (uint)Vector<byte>.Count;
28 Vector<ushort> right = new Vector<ushort>(255);
29 if (Vector.LessThanOrEqualAll(Unsafe.ReadUnaligned<Vector<ushort>>(pBuffer), right))
30 {
31 char* ptr2 = pBuffer + bufferLength - count;
32 pBuffer = (char*)((nuint)((byte*)pBuffer + count2) & ~(nuint)(count2 - 1));
33 while (!Vector.GreaterThanAny(Unsafe.Read<Vector<ushort>>(pBuffer), right))
34 {
35 pBuffer += count;
36 if (pBuffer > ptr2)
37 {
38 break;
39 }
40 }
41 bufferLength -= (nuint)(nint)(pBuffer - ptr);
42 }
43 }
44 while (true)
45 {
46 uint num;
47 if (bufferLength >= 4)
48 {
49 num = Unsafe.ReadUnaligned<uint>(pBuffer);
50 uint num2 = Unsafe.ReadUnaligned<uint>(pBuffer + 2);
51 if (!AllCharsInUInt32AreLatin1(num | num2))
52 {
54 {
55 num = num2;
56 pBuffer += 2;
57 }
58 goto IL_010f;
59 }
60 pBuffer += 4;
61 bufferLength -= 4;
62 continue;
63 }
64 if ((bufferLength & 2) != 0)
65 {
66 num = Unsafe.ReadUnaligned<uint>(pBuffer);
68 {
69 goto IL_010f;
70 }
71 pBuffer += 2;
72 }
73 if ((bufferLength & 1) != 0 && *pBuffer <= 'ÿ')
74 {
75 pBuffer++;
76 }
77 break;
78 IL_010f:
80 {
81 pBuffer++;
82 }
83 break;
84 }
85 nuint num3 = (nuint)((byte*)pBuffer - (nuint)ptr);
86 return num3 / 2;
87 }
88
89 private unsafe static nuint GetIndexOfFirstNonLatin1Char_Sse2(char* pBuffer, nuint bufferLength)
90 {
91 if (bufferLength == 0)
92 {
93 return 0u;
94 }
95 uint num = (uint)Unsafe.SizeOf<Vector128<byte>>();
96 uint num2 = num / 2;
97 char* ptr = pBuffer;
99 Vector128<ushort> right2;
101 uint num3;
102 if (bufferLength >= num2)
103 {
104 right = Vector128.Create((ushort)65280);
105 right2 = Vector128.Create((ushort)32512);
106 left = Sse2.LoadVector128((ushort*)pBuffer);
107 num3 = (uint)Sse2.MoveMask(Sse2.AddSaturate(left, right2).AsByte());
108 if ((num3 & 0xAAAA) == 0)
109 {
110 bufferLength <<= 1;
111 if (bufferLength < 2 * num)
112 {
113 goto IL_013e;
114 }
115 pBuffer = (char*)((nuint)((byte*)pBuffer + num) & ~(nuint)(num - 1));
116 bufferLength = (nuint)(bufferLength + (byte*)ptr);
117 bufferLength -= (nuint)pBuffer;
118 if (bufferLength < 2 * num)
119 {
120 goto IL_00fa;
121 }
122 char* ptr2 = (char*)((byte*)pBuffer + bufferLength - 2 * num);
123 Vector128<ushort> vector;
124 while (true)
125 {
126 left = Sse2.LoadAlignedVector128((ushort*)pBuffer);
127 vector = Sse2.LoadAlignedVector128((ushort*)(pBuffer + num2));
128 Vector128<ushort> left2 = Sse2.Or(left, vector);
129 if (Sse41.IsSupported)
130 {
131 if (!Sse41.TestZ(left2, right))
132 {
133 break;
134 }
135 }
136 else
137 {
138 num3 = (uint)Sse2.MoveMask(Sse2.AddSaturate(left2, right2).AsByte());
139 if ((num3 & 0xAAAAu) != 0)
140 {
141 break;
142 }
143 }
144 pBuffer += 2 * num2;
145 if (pBuffer <= ptr2)
146 {
147 continue;
148 }
149 goto IL_00fa;
150 }
151 if (Sse41.IsSupported)
152 {
153 if (!Sse41.TestZ(left, right))
154 {
155 goto IL_01e6;
156 }
157 }
158 else
159 {
160 num3 = (uint)Sse2.MoveMask(Sse2.AddSaturate(left, right2).AsByte());
161 if ((num3 & 0xAAAAu) != 0)
162 {
163 goto IL_01fa;
164 }
165 }
166 pBuffer += num2;
167 left = vector;
168 goto IL_01e6;
169 }
170 goto IL_01fa;
171 }
172 uint num5;
173 if ((bufferLength & 4) != 0)
174 {
175 if (Bmi1.X64.IsSupported)
176 {
177 ulong num4 = Unsafe.ReadUnaligned<ulong>(pBuffer);
178 if (!AllCharsInUInt64AreLatin1(num4))
179 {
180 num4 &= 0xFF00FF00FF00FF00uL;
181 pBuffer = (char*)((byte*)pBuffer + (nuint)((nint)(Bmi1.X64.TrailingZeroCount(num4) / 8) & ~(nint)1));
182 goto IL_01a1;
183 }
184 }
185 else
186 {
187 num5 = Unsafe.ReadUnaligned<uint>(pBuffer);
188 uint num6 = Unsafe.ReadUnaligned<uint>(pBuffer + 2);
189 if (!AllCharsInUInt32AreLatin1(num5 | num6))
190 {
192 {
193 num5 = num6;
194 pBuffer += 2;
195 }
196 goto IL_0214;
197 }
198 }
199 pBuffer += 4;
200 }
201 if ((bufferLength & 2) != 0)
202 {
203 num5 = Unsafe.ReadUnaligned<uint>(pBuffer);
204 if (!AllCharsInUInt32AreLatin1(num5))
205 {
206 goto IL_0214;
207 }
208 pBuffer += 2;
209 }
210 if ((bufferLength & 1) != 0 && *pBuffer <= 'ÿ')
211 {
212 pBuffer++;
213 }
214 goto IL_01a1;
215 IL_01e6:
216 num3 = (uint)Sse2.MoveMask(Sse2.AddSaturate(left, right2).AsByte());
217 goto IL_01fa;
218 IL_0214:
220 {
221 pBuffer++;
222 }
223 goto IL_01a1;
224 IL_01a1:
225 return (nuint)(pBuffer - ptr);
226 IL_0148:
227 if (((byte)bufferLength & (num - 1)) != 0)
228 {
229 pBuffer = (char*)((byte*)pBuffer + (bufferLength & (num - 1)) - num);
230 left = Sse2.LoadVector128((ushort*)pBuffer);
231 if (Sse41.IsSupported)
232 {
233 if (!Sse41.TestZ(left, right))
234 {
235 goto IL_01e6;
236 }
237 }
238 else
239 {
240 num3 = (uint)Sse2.MoveMask(Sse2.AddSaturate(left, right2).AsByte());
241 if ((num3 & 0xAAAAu) != 0)
242 {
243 goto IL_01fa;
244 }
245 }
246 pBuffer += num2;
247 }
248 goto IL_01a1;
249 IL_00fa:
250 if ((bufferLength & num) != 0)
251 {
252 left = Sse2.LoadAlignedVector128((ushort*)pBuffer);
253 if (Sse41.IsSupported)
254 {
255 if (!Sse41.TestZ(left, right))
256 {
257 goto IL_01e6;
258 }
259 }
260 else
261 {
262 num3 = (uint)Sse2.MoveMask(Sse2.AddSaturate(left, right2).AsByte());
263 if ((num3 & 0xAAAAu) != 0)
264 {
265 goto IL_01fa;
266 }
267 }
268 goto IL_013e;
269 }
270 goto IL_0148;
271 IL_01fa:
272 num3 &= 0xAAAAu;
273 pBuffer = (char*)((byte*)pBuffer + (uint)BitOperations.TrailingZeroCount(num3) - 1);
274 goto IL_01a1;
275 IL_013e:
276 pBuffer += num2;
277 goto IL_0148;
278 }
279
280 public unsafe static nuint NarrowUtf16ToLatin1(char* pUtf16Buffer, byte* pLatin1Buffer, nuint elementCount)
281 {
282 nuint num = 0u;
283 uint num2 = 0u;
284 uint num3 = 0u;
285 ulong num4 = 0uL;
286 if (Sse2.IsSupported)
287 {
288 if (elementCount >= (uint)(2 * Unsafe.SizeOf<Vector128<byte>>()))
289 {
290 _ = IntPtr.Size;
291 num4 = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer);
292 if (!AllCharsInUInt64AreLatin1(num4))
293 {
294 goto IL_0191;
295 }
296 num = NarrowUtf16ToLatin1_Sse2(pUtf16Buffer, pLatin1Buffer, elementCount);
297 }
298 }
300 {
301 uint num5 = (uint)Unsafe.SizeOf<Vector<byte>>();
302 if (elementCount >= 2 * num5)
303 {
304 _ = IntPtr.Size;
305 num4 = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer);
306 if (!AllCharsInUInt64AreLatin1(num4))
307 {
308 goto IL_0191;
309 }
310 Vector<ushort> right = new Vector<ushort>(255);
311 nuint num6 = elementCount - 2 * num5;
312 do
313 {
314 Vector<ushort> vector = Unsafe.ReadUnaligned<Vector<ushort>>(pUtf16Buffer + num);
315 Vector<ushort> vector2 = Unsafe.ReadUnaligned<Vector<ushort>>(pUtf16Buffer + num + Vector<ushort>.Count);
316 if (Vector.GreaterThanAny(Vector.BitwiseOr(vector, vector2), right))
317 {
318 break;
319 }
320 Vector<byte> value = Vector.Narrow(vector, vector2);
321 Unsafe.WriteUnaligned(pLatin1Buffer + num, value);
322 num += num5;
323 }
324 while (num <= num6);
325 }
326 }
327 nuint num7 = elementCount - num;
328 if (num7 < 4)
329 {
330 goto IL_013a;
331 }
332 nuint num8 = num + num7 - 4;
333 while (true)
334 {
335 _ = IntPtr.Size;
336 num4 = Unsafe.ReadUnaligned<ulong>(pUtf16Buffer + num);
337 if (!AllCharsInUInt64AreLatin1(num4))
338 {
339 break;
340 }
341 NarrowFourUtf16CharsToLatin1AndWriteToBuffer(ref pLatin1Buffer[num], num4);
342 num += 4;
343 if (num <= num8)
344 {
345 continue;
346 }
347 goto IL_013a;
348 }
349 goto IL_0191;
350 IL_01ca:
352 {
354 {
355 }
356 pLatin1Buffer[num] = (byte)num2;
357 num++;
358 }
359 goto IL_018f;
360 IL_018f:
361 return num;
362 IL_013a:
363 if (((uint)(int)num7 & 2u) != 0)
364 {
365 num2 = Unsafe.ReadUnaligned<uint>(pUtf16Buffer + num);
366 if (!AllCharsInUInt32AreLatin1(num2))
367 {
368 goto IL_01ca;
369 }
370 NarrowTwoUtf16CharsToLatin1AndWriteToBuffer(ref pLatin1Buffer[num], num2);
371 num += 2;
372 }
373 if (((uint)(int)num7 & (true ? 1u : 0u)) != 0)
374 {
375 num2 = pUtf16Buffer[num];
376 if (num2 <= 255)
377 {
378 pLatin1Buffer[num] = (byte)num2;
379 num++;
380 }
381 }
382 goto IL_018f;
383 IL_0191:
384 _ = IntPtr.Size;
386 num2 = (uint)num4;
388 {
389 NarrowTwoUtf16CharsToLatin1AndWriteToBuffer(ref pLatin1Buffer[num], num2);
391 num2 = (uint)(num4 >> 32);
392 num += 2;
393 }
394 goto IL_01ca;
395 }
396
397 private unsafe static nuint NarrowUtf16ToLatin1_Sse2(char* pUtf16Buffer, byte* pLatin1Buffer, nuint elementCount)
398 {
399 uint num = (uint)Unsafe.SizeOf<Vector128<byte>>();
400 nuint num2 = num - 1;
401 Vector128<short> right = Vector128.Create((short)(-256));
402 Vector128<ushort> right2 = Vector128.Create((ushort)32512);
403 Vector128<short> vector = Sse2.LoadVector128((short*)pUtf16Buffer);
404 if (Sse41.IsSupported)
405 {
406 if (!Sse41.TestZ(vector, right))
407 {
408 return 0u;
409 }
410 }
411 else if (((uint)Sse2.MoveMask(Sse2.AddSaturate(vector.AsUInt16(), right2).AsByte()) & 0xAAAAu) != 0)
412 {
413 return 0u;
414 }
415 Vector128<byte> vector2 = Sse2.PackUnsignedSaturate(vector, vector);
416 Sse2.StoreScalar((ulong*)pLatin1Buffer, vector2.AsUInt64());
417 nuint num3 = num / 2;
418 if (((uint)(int)pLatin1Buffer & (num / 2)) != 0)
419 {
420 goto IL_00ea;
421 }
422 vector = Sse2.LoadVector128((short*)(pUtf16Buffer + num3));
423 if (Sse41.IsSupported)
424 {
425 if (Sse41.TestZ(vector, right))
426 {
427 goto IL_00cd;
428 }
429 }
430 else if ((Sse2.MoveMask(Sse2.AddSaturate(vector.AsUInt16(), right2).AsByte()) & 0xAAAA) == 0)
431 {
432 goto IL_00cd;
433 }
434 goto IL_0186;
435 IL_0186:
436 return num3;
437 IL_00cd:
438 vector2 = Sse2.PackUnsignedSaturate(vector, vector);
439 Sse2.StoreScalar((ulong*)(pLatin1Buffer + num3), vector2.AsUInt64());
440 goto IL_00ea;
441 IL_00ea:
442 num3 = num - ((nuint)pLatin1Buffer & num2);
443 nuint num4 = elementCount - num;
444 do
445 {
446 vector = Sse2.LoadVector128((short*)(pUtf16Buffer + num3));
447 Vector128<short> right3 = Sse2.LoadVector128((short*)(pUtf16Buffer + num3 + num / 2));
448 Vector128<short> vector3 = Sse2.Or(vector, right3);
449 if (Sse41.IsSupported)
450 {
451 if (Sse41.TestZ(vector3, right))
452 {
453 goto IL_015e;
454 }
455 }
456 else if ((Sse2.MoveMask(Sse2.AddSaturate(vector3.AsUInt16(), right2).AsByte()) & 0xAAAA) == 0)
457 {
458 goto IL_015e;
459 }
460 if (Sse41.IsSupported)
461 {
462 if (!Sse41.TestZ(vector, right))
463 {
464 break;
465 }
466 }
467 else if (((uint)Sse2.MoveMask(Sse2.AddSaturate(vector.AsUInt16(), right2).AsByte()) & 0xAAAAu) != 0)
468 {
469 break;
470 }
471 vector2 = Sse2.PackUnsignedSaturate(vector, vector);
472 Sse2.StoreScalar((ulong*)(pLatin1Buffer + num3), vector2.AsUInt64());
473 num3 += num / 2;
474 break;
475 IL_015e:
476 vector2 = Sse2.PackUnsignedSaturate(vector, right3);
477 Sse2.StoreAligned(pLatin1Buffer + num3, vector2);
478 num3 += num;
479 }
480 while (num3 <= num4);
481 goto IL_0186;
482 }
483
484 public unsafe static void WidenLatin1ToUtf16(byte* pLatin1Buffer, char* pUtf16Buffer, nuint elementCount)
485 {
486 if (Sse2.IsSupported)
487 {
488 WidenLatin1ToUtf16_Sse2(pLatin1Buffer, pUtf16Buffer, elementCount);
489 }
490 else
491 {
492 WidenLatin1ToUtf16_Fallback(pLatin1Buffer, pUtf16Buffer, elementCount);
493 }
494 }
495
496 private unsafe static void WidenLatin1ToUtf16_Sse2(byte* pLatin1Buffer, char* pUtf16Buffer, nuint elementCount)
497 {
498 uint num = (uint)Unsafe.SizeOf<Vector128<byte>>();
499 nuint num2 = num - 1;
500 nuint num3 = 0u;
502 if (elementCount >= num)
503 {
504 Vector128<byte> left = Sse2.LoadScalarVector128((ulong*)pLatin1Buffer).AsByte();
505 Sse2.Store((byte*)pUtf16Buffer, Sse2.UnpackLow(left, zero));
506 num3 = (num >> 1) - (((nuint)pUtf16Buffer >> 1) & (num2 >> 1));
507 char* ptr = pUtf16Buffer + num3;
508 nuint num4 = elementCount - num;
509 while (num3 <= num4)
510 {
511 left = Sse2.LoadVector128(pLatin1Buffer + num3);
512 Vector128<byte> source = Sse2.UnpackLow(left, zero);
513 Sse2.StoreAligned((byte*)ptr, source);
514 Vector128<byte> source2 = Sse2.UnpackHigh(left, zero);
515 Sse2.StoreAligned((byte*)ptr + num, source2);
516 num3 += num;
517 ptr += num;
518 }
519 }
520 uint num5 = (uint)((int)elementCount - (int)num3);
521 if ((num5 & 8u) != 0)
522 {
523 Vector128<byte> left = Sse2.LoadScalarVector128((ulong*)(pLatin1Buffer + num3)).AsByte();
524 Sse2.Store((byte*)(pUtf16Buffer + num3), Sse2.UnpackLow(left, zero));
525 num3 += 8;
526 }
527 if ((num5 & 4u) != 0)
528 {
529 Vector128<byte> left = Sse2.LoadScalarVector128((uint*)(pLatin1Buffer + num3)).AsByte();
530 Sse2.StoreScalar((ulong*)(pUtf16Buffer + num3), Sse2.UnpackLow(left, zero).AsUInt64());
531 num3 += 4;
532 }
533 if ((num5 & 3) == 0)
534 {
535 return;
536 }
537 pUtf16Buffer[num3] = (char)pLatin1Buffer[num3];
538 if ((num5 & 2u) != 0)
539 {
540 pUtf16Buffer[num3 + 1] = (char)pLatin1Buffer[num3 + 1];
541 if ((num5 & (true ? 1u : 0u)) != 0)
542 {
543 pUtf16Buffer[num3 + 2] = (char)pLatin1Buffer[num3 + 2];
544 }
545 }
546 }
547
548 private unsafe static void WidenLatin1ToUtf16_Fallback(byte* pLatin1Buffer, char* pUtf16Buffer, nuint elementCount)
549 {
550 nuint num = 0u;
552 {
553 uint count = (uint)Vector<byte>.Count;
554 if (elementCount >= count)
555 {
556 nuint num2 = elementCount - count;
557 do
558 {
559 Vector<byte> value = Unsafe.ReadUnaligned<Vector<byte>>(pLatin1Buffer + num);
560 Vector.Widen(Vector.AsVectorByte(value), out var low, out var high);
561 Unsafe.WriteUnaligned(pUtf16Buffer + num, low);
562 Unsafe.WriteUnaligned(pUtf16Buffer + num + Vector<ushort>.Count, high);
563 num += count;
564 }
565 while (num <= num2);
566 }
567 }
568 for (; num < elementCount; num++)
569 {
570 pUtf16Buffer[num] = (char)pLatin1Buffer[num];
571 }
572 }
573
574 [MethodImpl(MethodImplOptions.AggressiveInlining)]
575 private static bool AllCharsInUInt32AreLatin1(uint value)
576 {
577 return (value & 0xFF00FF00u) == 0;
578 }
579
580 [MethodImpl(MethodImplOptions.AggressiveInlining)]
581 private static bool AllCharsInUInt64AreLatin1(ulong value)
582 {
583 return (value & 0xFF00FF00FF00FF00uL) == 0;
584 }
585
586 private static bool FirstCharInUInt32IsLatin1(uint value)
587 {
589 if ((value & 0xFF00u) != 0)
590 {
592 {
593 }
594 return false;
595 }
596 return true;
597 }
598
599 [MethodImpl(MethodImplOptions.AggressiveInlining)]
600 private static void NarrowFourUtf16CharsToLatin1AndWriteToBuffer(ref byte outputBuffer, ulong value)
601 {
602 if (Sse2.X64.IsSupported)
603 {
605 Vector128<uint> value2 = Sse2.PackUnsignedSaturate(vector, vector).AsUInt32();
606 Unsafe.WriteUnaligned(ref outputBuffer, Sse2.ConvertToUInt32(value2));
607 return;
608 }
610 outputBuffer = (byte)value;
611 value >>= 16;
612 Unsafe.Add(ref outputBuffer, 1) = (byte)value;
613 value >>= 16;
614 Unsafe.Add(ref outputBuffer, 2) = (byte)value;
615 value >>= 16;
616 Unsafe.Add(ref outputBuffer, 3) = (byte)value;
617 }
618
619 [MethodImpl(MethodImplOptions.AggressiveInlining)]
620 private static void NarrowTwoUtf16CharsToLatin1AndWriteToBuffer(ref byte outputBuffer, uint value)
621 {
623 outputBuffer = (byte)value;
624 Unsafe.Add(ref outputBuffer, 1) = (byte)(value >> 16);
625 }
626}
static readonly bool IsLittleEndian
static int TrailingZeroCount(int value)
static bool IsHardwareAccelerated
Definition Vector.cs:14
static unsafe void Widen(Vector< byte > source, out Vector< ushort > low, out Vector< ushort > high)
Definition Vector.cs:493
static unsafe Vector< byte > Narrow(Vector< ushort > low, Vector< ushort > high)
Definition Vector.cs:623
static Vector128< byte > Create(byte value)
Definition Vector128.cs:138
static ulong TrailingZeroCount(ulong value)
Definition Bmi1.cs:44
static Vector128< ulong > ConvertScalarToVector128UInt64(ulong value)
Definition Sse2.cs:39
static unsafe Vector128< sbyte > LoadVector128(sbyte *address)
Definition Sse2.cs:582
static unsafe Vector128< double > LoadScalarVector128(double *address)
Definition Sse2.cs:627
static int MoveMask(Vector128< sbyte > value)
Definition Sse2.cs:772
static unsafe Vector128< sbyte > LoadAlignedVector128(sbyte *address)
Definition Sse2.cs:632
static uint ConvertToUInt32(Vector128< uint > value)
Definition Sse2.cs:512
static unsafe void StoreScalar(double *address, Vector128< double > source)
Definition Sse2.cs:1172
static unsafe void Store(sbyte *address, Vector128< sbyte > source)
Definition Sse2.cs:1287
static Vector128< byte > PackUnsignedSaturate(Vector128< short > left, Vector128< short > right)
Definition Sse2.cs:892
static Vector128< byte > Or(Vector128< byte > left, Vector128< byte > right)
Definition Sse2.cs:837
static Vector128< sbyte > AddSaturate(Vector128< sbyte > left, Vector128< sbyte > right)
Definition Sse2.cs:112
static unsafe void StoreAligned(sbyte *address, Vector128< sbyte > source)
Definition Sse2.cs:1197
static Vector128< byte > UnpackLow(Vector128< byte > left, Vector128< byte > right)
Definition Sse2.cs:1467
static new bool IsSupported
Definition Sse2.cs:60
static Vector128< byte > UnpackHigh(Vector128< byte > left, Vector128< byte > right)
Definition Sse2.cs:1422
static bool TestZ(Vector128< sbyte > left, Vector128< sbyte > right)
Definition Sse41.cs:692
static bool FirstCharInUInt32IsLatin1(uint value)
static unsafe void WidenLatin1ToUtf16(byte *pLatin1Buffer, char *pUtf16Buffer, nuint elementCount)
static void NarrowTwoUtf16CharsToLatin1AndWriteToBuffer(ref byte outputBuffer, uint value)
static unsafe nuint NarrowUtf16ToLatin1_Sse2(char *pUtf16Buffer, byte *pLatin1Buffer, nuint elementCount)
static void NarrowFourUtf16CharsToLatin1AndWriteToBuffer(ref byte outputBuffer, ulong value)
static bool AllCharsInUInt32AreLatin1(uint value)
static unsafe nuint GetIndexOfFirstNonLatin1Char(char *pBuffer, nuint bufferLength)
static unsafe nuint NarrowUtf16ToLatin1(char *pUtf16Buffer, byte *pLatin1Buffer, nuint elementCount)
static unsafe void WidenLatin1ToUtf16_Sse2(byte *pLatin1Buffer, char *pUtf16Buffer, nuint elementCount)
static unsafe void WidenLatin1ToUtf16_Fallback(byte *pLatin1Buffer, char *pUtf16Buffer, nuint elementCount)
static unsafe nuint GetIndexOfFirstNonLatin1Char_Default(char *pBuffer, nuint bufferLength)
static bool AllCharsInUInt64AreLatin1(ulong value)
static unsafe nuint GetIndexOfFirstNonLatin1Char_Sse2(char *pBuffer, nuint bufferLength)
static int Size
Definition IntPtr.cs:21