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

◆ IndexOfOrLessThan()

static unsafe int System.Text.Json.JsonReaderHelper.IndexOfOrLessThan ( ref byte searchSpace,
byte value0,
byte value1,
byte lessThan,
int length )
inlinestaticprivate

Definition at line 66 of file JsonReaderHelper.cs.

67 {
68 IntPtr intPtr = (IntPtr)0;
71 {
72 int num = (int)Unsafe.AsPointer(ref searchSpace) & (Vector<byte>.Count - 1);
73 intPtr2 = (IntPtr)((Vector<byte>.Count - num) & (Vector<byte>.Count - 1));
74 }
75 while (true)
76 {
77 if ((nuint)(void*)intPtr2 >= (nuint)8u)
78 {
79 intPtr2 -= 8;
80 uint num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr);
81 if (value0 == num2 || value1 == num2 || lessThan > num2)
82 {
83 goto IL_0393;
84 }
85 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 1);
86 if (value0 == num2 || value1 == num2 || lessThan > num2)
87 {
88 goto IL_039b;
89 }
90 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 2);
91 if (value0 == num2 || value1 == num2 || lessThan > num2)
92 {
93 goto IL_03a9;
94 }
95 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 3);
96 if (value0 != num2 && value1 != num2 && lessThan <= num2)
97 {
98 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 4);
99 if (value0 != num2 && value1 != num2 && lessThan <= num2)
100 {
101 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 5);
102 if (value0 != num2 && value1 != num2 && lessThan <= num2)
103 {
104 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 6);
105 if (value0 != num2 && value1 != num2 && lessThan <= num2)
106 {
107 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 7);
108 if (value0 == num2 || value1 == num2 || lessThan > num2)
109 {
110 break;
111 }
112 intPtr += 8;
113 continue;
114 }
115 return (int)(void*)(intPtr + 6);
116 }
117 return (int)(void*)(intPtr + 5);
118 }
119 return (int)(void*)(intPtr + 4);
120 }
121 goto IL_03b7;
122 }
123 if ((nuint)(void*)intPtr2 >= (nuint)4u)
124 {
125 intPtr2 -= 4;
126 uint num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr);
127 if (value0 == num2 || value1 == num2 || lessThan > num2)
128 {
129 goto IL_0393;
130 }
131 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 1);
132 if (value0 == num2 || value1 == num2 || lessThan > num2)
133 {
134 goto IL_039b;
135 }
136 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 2);
137 if (value0 == num2 || value1 == num2 || lessThan > num2)
138 {
139 goto IL_03a9;
140 }
141 num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr + 3);
142 if (value0 == num2 || value1 == num2 || lessThan > num2)
143 {
144 goto IL_03b7;
145 }
146 intPtr += 4;
147 }
148 while ((void*)intPtr2 != null)
149 {
150 intPtr2 -= 1;
151 uint num2 = Unsafe.AddByteOffset(ref searchSpace, intPtr);
152 if (value0 != num2 && value1 != num2 && lessThan <= num2)
153 {
154 intPtr += 1;
155 continue;
156 }
157 goto IL_0393;
158 }
159 if (Vector.IsHardwareAccelerated && (int)(void*)intPtr < length)
160 {
161 intPtr2 = (IntPtr)((length - (int)(void*)intPtr) & ~(Vector<byte>.Count - 1));
162 Vector<byte> right = new Vector<byte>(value0);
165 for (; (void*)intPtr2 > (void*)intPtr; intPtr += Vector<byte>.Count)
166 {
167 Vector<byte> left = Unsafe.ReadUnaligned<Vector<byte>>(ref Unsafe.AddByteOffset(ref searchSpace, intPtr));
168 Vector<byte> vector = Vector.BitwiseOr(Vector.BitwiseOr(Vector.Equals(left, right), Vector.Equals(left, right2)), Vector.LessThan(left, right3));
169 if (!Vector<byte>.Zero.Equals(vector))
170 {
171 return (int)(void*)intPtr + LocateFirstFoundByte(vector);
172 }
173 }
174 if ((int)(void*)intPtr < length)
175 {
176 intPtr2 = (IntPtr)(length - (int)(void*)intPtr);
177 continue;
178 }
179 }
180 return -1;
181 IL_0393:
182 return (int)(void*)intPtr;
183 IL_039b:
184 return (int)(void*)(intPtr + 1);
185 IL_03b7:
186 return (int)(void*)(intPtr + 3);
187 IL_03a9:
188 return (int)(void*)(intPtr + 2);
189 }
190 return (int)(void*)(intPtr + 7);
191 }
static Vector< int > LessThan(Vector< float > left, Vector< float > right)
Definition Vector.cs:99
static bool IsHardwareAccelerated
Definition Vector.cs:14
static Vector< int > Equals(Vector< float > left, Vector< float > right)
Definition Vector.cs:52
static int LocateFirstFoundByte(Vector< byte > match)

References System.Numerics.Vector< T >.Count, System.Text.Json.Dictionary, System.Numerics.Vector< T >.Equals(), System.Text.Json.JsonReaderHelper.int, System.Numerics.Vector< T >.IsHardwareAccelerated, System.length, System.Numerics.Vector< T >.LessThan(), and System.Text.Json.JsonReaderHelper.LocateFirstFoundByte().

Referenced by System.Text.Json.JsonReaderHelper.IndexOfQuoteOrAnyControlOrBackSlash().