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

◆ MakeSeparatorListVectorized()

void System.String.MakeSeparatorListVectorized ( ref ValueListBuilder< int > sepListBuilder,
char c,
char c2,
char c3 )
inlineprivate

Definition at line 2887 of file String.cs.

2888 {
2889 if (!Sse41.IsSupported)
2890 {
2891 throw new PlatformNotSupportedException();
2892 }
2893 Vector128<byte> mask = Vector128.Create(0, 2, 4, 6, 8, 10, 12, 14, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue);
2897 ref char reference = ref MemoryMarshal.GetReference(this.AsSpan());
2898 int num = Length & -Vector128<ushort>.Count;
2899 int i;
2901 {
2906 if (Sse41.TestZ(right4, right4))
2907 {
2908 continue;
2909 }
2910 Vector128<byte> value = Sse2.ShiftRightLogical(right4.AsUInt64(), 4).AsByte();
2912 uint num2 = Sse2.ConvertToUInt32(value.AsUInt32());
2913 value = Sse2.ShiftRightLogical(value.AsUInt64(), 32).AsByte();
2914 uint num3 = Sse2.ConvertToUInt32(value.AsUInt32());
2915 int num4 = i;
2916 while (num2 != 0)
2917 {
2918 if ((num2 & 0xFu) != 0)
2919 {
2920 sepListBuilder.Append(num4);
2921 }
2922 num2 >>= 8;
2923 num4++;
2924 }
2925 int num5 = i + 4;
2926 while (num3 != 0)
2927 {
2928 if ((num3 & 0xFu) != 0)
2929 {
2930 sepListBuilder.Append(num5);
2931 }
2932 num3 >>= 8;
2933 num5++;
2934 }
2935 }
2936 for (; i < Length; i++)
2937 {
2938 char c4 = Unsafe.Add(ref reference, (IntPtr)(uint)i);
2939 if (c4 == c || c4 == c2 || c4 == c3)
2940 {
2941 sepListBuilder.Append(i);
2942 }
2943 }
2944 static Vector128<ushort> ReadVector(ref char c0, int offset)
2945 {
2946 return Unsafe.ReadUnaligned<Vector128<ushort>>(ref Unsafe.As<char, byte>(ref Unsafe.Add(ref c0, (IntPtr)(uint)offset)));
2947 }
2948 }
static Vector128< byte > Create(byte value)
Definition Vector128.cs:138
static uint ConvertToUInt32(Vector128< uint > value)
Definition Sse2.cs:512
static Vector128< sbyte > CompareEqual(Vector128< sbyte > left, Vector128< sbyte > right)
Definition Sse2.cs:232
static Vector128< byte > Or(Vector128< byte > left, Vector128< byte > right)
Definition Sse2.cs:837
static Vector128< short > ShiftRightLogical(Vector128< short > value, Vector128< short > count)
Definition Sse2.cs:1057
static bool TestZ(Vector128< sbyte > left, Vector128< sbyte > right)
Definition Sse41.cs:692
static Vector128< sbyte > Shuffle(Vector128< sbyte > value, Vector128< sbyte > mask)
Definition Ssse3.cs:112

References System.Runtime.Intrinsics.X86.Sse2.CompareEqual(), System.Runtime.Intrinsics.X86.Sse2.ConvertToUInt32(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Runtime.Intrinsics.Vector128< T >.Create(), System.Runtime.Intrinsics.X86.Sse41.IsSupported, System.String.Length, System.offset, System.Runtime.Intrinsics.X86.Sse2.Or(), System.Runtime.Intrinsics.X86.Sse2.ShiftRightLogical(), System.Runtime.Intrinsics.X86.Ssse3.Shuffle(), System.Runtime.Intrinsics.X86.Sse41.TestZ(), and System.value.

Referenced by System.String.MakeSeparatorList().