Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetIndexOfFirstCharToEncode()

unsafe int System.Text.Encodings.Web.OptimizedInboxTextEncoder.GetIndexOfFirstCharToEncode ( ReadOnlySpan< char > data)
inline

Definition at line 368 of file OptimizedInboxTextEncoder.cs.

369 {
370 fixed (char* ptr = data)
371 {
372 nuint num = (uint)data.Length;
373 nuint num2 = 0u;
374 if (Ssse3.IsSupported)
375 {
376 num2 = GetIndexOfFirstCharToEncodeSsse3(ptr, num);
377 }
378 else if (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian)
379 {
381 }
382 if (num2 < num)
383 {
385 nint num3 = 0;
386 while (true)
387 {
388 if (num - num2 >= 8)
389 {
390 num3 = -1;
391 if (_allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]) && _allowedBmpCodePoints.IsCharAllowed(ptr[(nuint)((nint)num2 + ++num3)]))
392 {
393 num2 += 8;
394 continue;
395 }
396 num2 += (nuint)num3;
397 break;
398 }
399 for (; num2 < num && _allowedBmpCodePoints.IsCharAllowed(ptr[num2]); num2++)
400 {
401 }
402 break;
403 }
404 }
405 int num4 = (int)num2;
406 if (num4 == (int)num)
407 {
408 num4 = -1;
409 }
410 return num4;
411 }
412 }
unsafe nuint GetIndexOfFirstCharToEncodeSsse3(char *pData, nuint lengthInChars)
unsafe nuint GetIndexOfFirstCharToEncodeAdvSimd64(char *pData, nuint lengthInChars)

References System.Text.Encodings.Web.OptimizedInboxTextEncoder._allowedBmpCodePoints, System.Text.Encodings.Web.OptimizedInboxTextEncoder._AssertThisNotNull(), System.Text.Encodings.Web.OptimizedInboxTextEncoder.GetIndexOfFirstCharToEncodeAdvSimd64(), System.Text.Encodings.Web.OptimizedInboxTextEncoder.GetIndexOfFirstCharToEncodeSsse3(), System.Text.Encodings.Web.AllowedBmpCodePointsBitmap.IsCharAllowed(), System.BitConverter.IsLittleEndian, System.Runtime.Intrinsics.Arm.AdvSimd.Arm64.IsSupported, System.Runtime.Intrinsics.X86.Ssse3.IsSupported, and System.ReadOnlySpan< T >.Length.

Referenced by System.Text.Encodings.Web.OptimizedInboxTextEncoder.FindFirstCharacterToEncode(), System.Text.Encodings.Web.DefaultHtmlEncoder.FindFirstCharacterToEncode(), System.Text.Encodings.Web.DefaultJavaScriptEncoder.FindFirstCharacterToEncode(), and System.Text.Encodings.Web.DefaultUrlEncoder.FindFirstCharacterToEncode().