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

◆ Avx2Decode()

static unsafe void System.Buffers.Text.Base64.Avx2Decode ( ref byte * srcBytes,
ref byte * destBytes,
byte * srcEnd,
int sourceLength,
int destLength,
byte * srcStart,
byte * destStart )
inlinestaticprivate

Definition at line 308 of file Base64.cs.

309 {
310 Vector256<sbyte> value = Vector256.Create(16, 16, 1, 2, 4, 8, 4, 8, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 2, 4, 8, 4, 8, 16, 16, 16, 16, 16, 16, 16, 16);
311 Vector256<sbyte> value2 = Vector256.Create(21, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 26, 27, 27, 27, 26, 21, 17, 17, 17, 17, 17, 17, 17, 17, 17, 19, 26, 27, 27, 27, 26);
312 Vector256<sbyte> value3 = Vector256.Create(0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 19, 4, -65, -65, -71, -71, 0, 0, 0, 0, 0, 0, 0, 0);
313 Vector256<sbyte> mask = Vector256.Create(2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1, 2, 1, 0, 6, 5, 4, 10, 9, 8, 14, 13, 12, -1, -1, -1, -1);
314 Vector256<int> control = Vector256.Create(0, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 6, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1).AsInt32();
315 Vector256<sbyte> right = Vector256.Create((sbyte)47);
316 Vector256<sbyte> right2 = Vector256.Create(20971840).AsSByte();
317 Vector256<short> right3 = Vector256.Create(69632).AsInt16();
318 byte* ptr = srcBytes;
319 byte* ptr2 = destBytes;
320 do
321 {
322 Vector256<sbyte> vector = Avx.LoadVector256(ptr).AsSByte();
323 Vector256<sbyte> vector2 = Avx2.And(Avx2.ShiftRightLogical(vector.AsInt32(), 4).AsSByte(), right);
324 Vector256<sbyte> mask2 = Avx2.And(vector, right);
325 Vector256<sbyte> right4 = Avx2.Shuffle(value, vector2);
326 Vector256<sbyte> left = Avx2.Shuffle(value2, mask2);
327 if (!Avx.TestZ(left, right4))
328 {
329 break;
330 }
331 Vector256<sbyte> left2 = Avx2.CompareEqual(vector, right);
332 Vector256<sbyte> right5 = Avx2.Shuffle(value3, Avx2.Add(left2, vector2));
333 vector = Avx2.Add(vector, right5);
334 Vector256<short> left3 = Avx2.MultiplyAddAdjacent(vector.AsByte(), right2);
335 Vector256<int> vector3 = Avx2.MultiplyAddAdjacent(left3, right3);
336 vector3 = Avx2.Shuffle(vector3.AsSByte(), mask).AsInt32();
337 vector = Avx2.PermuteVar8x32(vector3, control).AsSByte();
338 Avx.Store(ptr2, vector.AsByte());
339 ptr += 32;
340 ptr2 += 24;
341 }
342 while (ptr <= srcEnd);
343 srcBytes = ptr;
344 destBytes = ptr2;
345 }
static Vector256< byte > Create(byte value)
Definition Vector256.cs:105
static Vector256< sbyte > Add(Vector256< sbyte > left, Vector256< sbyte > right)
Definition Avx2.cs:32
static Vector256< sbyte > And(Vector256< sbyte > left, Vector256< sbyte > right)
Definition Avx2.cs:132
static Vector256< sbyte > CompareEqual(Vector256< sbyte > left, Vector256< sbyte > right)
Definition Avx2.cs:512
static Vector256< int > MultiplyAddAdjacent(Vector256< short > left, Vector256< short > right)
Definition Avx2.cs:1508
static Vector256< short > ShiftRightLogical(Vector256< short > value, Vector128< short > count)
Definition Avx2.cs:1938
static Vector256< sbyte > Shuffle(Vector256< sbyte > value, Vector256< sbyte > mask)
Definition Avx2.cs:2078
static Vector256< int > PermuteVar8x32(Vector256< int > left, Vector256< int > control)
Definition Avx2.cs:1753
static unsafe Vector256< sbyte > LoadVector256(sbyte *address)
Definition Avx.cs:462
static unsafe void Store(sbyte *address, Vector256< sbyte > source)
Definition Avx.cs:962
static bool TestZ(Vector128< float > left, Vector128< float > right)
Definition Avx.cs:1142

References System.Runtime.Intrinsics.X86.Avx2.Add(), System.Runtime.Intrinsics.X86.Avx2.And(), System.Runtime.Intrinsics.X86.Avx2.CompareEqual(), System.Runtime.Intrinsics.Vector256< T >.Create(), System.Runtime.Intrinsics.X86.Avx.LoadVector256(), System.Runtime.Intrinsics.X86.Avx2.MultiplyAddAdjacent(), System.Runtime.Intrinsics.X86.Avx2.PermuteVar8x32(), System.Runtime.Intrinsics.X86.Avx2.ShiftRightLogical(), System.Runtime.Intrinsics.X86.Avx2.Shuffle(), System.Runtime.Intrinsics.X86.Avx.Store(), System.Runtime.Intrinsics.X86.Avx.TestZ(), and System.value.

Referenced by System.Buffers.Text.Base64.DecodeFromUtf8().