public unsafe void ArrayWriteAlignment() { Assert.AreEqual(17, Unsafe.SizeOf <Struct17>()); var arr = new Struct17[2]; fixed(Struct17 *ptr = &arr[0]) { *ptr = new Struct17(); ptr[1] = new Struct17(); byte *bptr = (byte *)ptr; for (int i = 0; i < 34; i++) { Assert.AreEqual(0, bptr[i]); } } var x = new Struct17() { Field1 = 1 }; arr[1] = x; }
public unsafe void SpanUnalignedIndexOf() { var arr = new Struct17[2]; var value = new Struct17() { Field1 = 1 }; arr[1] = value; var span = arr.AsSpan(); Assert.AreEqual(1, span.IndexOf(value)); Assert.AreEqual(17, Unsafe.SizeOf <Struct17>()); Assert.AreEqual(17, (long)Unsafe.AsPointer(ref arr[1]) - (long)Unsafe.AsPointer(ref arr[0])); var v0 = arr[0]; var v1 = arr[1]; Assert.AreEqual(24, (long)Unsafe.AsPointer(ref v0) - (long)Unsafe.AsPointer(ref v1)); Assert.AreEqual(15, (long)Unsafe.AsPointer(ref v0) - (long)Unsafe.AsPointer(ref v1.Field2)); }
internal static extern bool SetWorldTransform(IntPtr A_0, ref Struct17 A_1);
internal static extern bool ModifyWorldTransform(IntPtr A_0, ref Struct17 A_1, int A_2);