using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; var vector1 = Vector256.Create(0x1122334455667788, 0x99AABBCCDDEEFF00, 0x1122334455667788, 0x99AABBCCDDEEFF00); var vector2 = Vector256.Create(0x0001020304050607, 0x08090A0B0C0D0E0F, 0x0001020304050607, 0x08090A0B0C0D0E0F); // Align vector2 to the right by 3 bytes var alignedVector = Avx2.AlignRight(vector1, vector2, 3); // Output: 0x11AABBCCDDEEFF000102030405060708
using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; var vector1 = Vector256.Create(0x1122334455667788, 0x99AABBCCDDEEFF00, 0x1122334455667788, 0x99AABBCCDDEEFF00); var vector2 = Vector256.Create(0x0001020304050607, 0x08090A0B0C0D0E0F, 0x0001020304050607, 0x08090A0B0C0D0E0F); // Align vector2 to the right automatically var alignedVector = Avx2.AlignRight(vector1, vector2, 32); // Output: 0xDDEEFF000102030405060708090A0B0C0DIn this example, the second vector is aligned to the right automatically using the `32` parameter, which means that it will be aligned to the right up to the byte that contains the most significant bit set in the first vector. The resulting vector is stored in `alignedVector`, which contains the bytes `[0xDD, 0xEE, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C]`.