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

◆ LastIndexOf() [3/3]

static unsafe int System.SpanHelpers.LastIndexOf ( ref char searchSpace,
char value,
int length )
inlinestatic

Definition at line 2595 of file SpanHelpers.cs.

2596 {
2597 fixed (char* ptr = &searchSpace)
2598 {
2599 char* ptr2 = ptr + length;
2600 char* ptr3 = ptr;
2602 {
2603 length = ((int)ptr2 & (Unsafe.SizeOf<Vector<ushort>>() - 1)) / 2;
2604 }
2605 while (true)
2606 {
2607 if (length >= 4)
2608 {
2609 length -= 4;
2610 ptr2 -= 4;
2611 if (ptr2[3] == value)
2612 {
2613 break;
2614 }
2615 if (ptr2[2] != value)
2616 {
2617 if (ptr2[1] != value)
2618 {
2619 if (*ptr2 != value)
2620 {
2621 continue;
2622 }
2623 goto IL_011d;
2624 }
2625 return (int)(ptr2 - ptr3) + 1;
2626 }
2627 return (int)(ptr2 - ptr3) + 2;
2628 }
2629 while (length > 0)
2630 {
2631 length--;
2632 ptr2--;
2633 if (*ptr2 != value)
2634 {
2635 continue;
2636 }
2637 goto IL_011d;
2638 }
2640 {
2641 length = (int)((ptr2 - ptr3) & ~(Vector<ushort>.Count - 1));
2643 while (length > 0)
2644 {
2645 char* ptr4 = ptr2 - Vector<ushort>.Count;
2647 if (Vector<ushort>.Zero.Equals(vector))
2648 {
2651 continue;
2652 }
2653 return (int)(ptr4 - ptr3) + LocateLastFoundChar(vector);
2654 }
2655 if (ptr2 > ptr3)
2656 {
2657 length = (int)(ptr2 - ptr3);
2658 continue;
2659 }
2660 }
2661 return -1;
2662 IL_011d:
2663 return (int)(ptr2 - ptr3);
2664 }
2665 return (int)(ptr2 - ptr3) + 3;
2666 }
2667 }
static bool IsHardwareAccelerated
Definition Vector.cs:14
static Vector< int > Equals(Vector< float > left, Vector< float > right)
Definition Vector.cs:52
static int LocateLastFoundChar(Vector< ushort > match)

References System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Numerics.Vector< T >.Equals(), System.Numerics.Vector< T >.IsHardwareAccelerated, System.length, System.SpanHelpers.LocateLastFoundChar(), and System.value.