public void ReinterpretFloatUint4() { var dummies = new DummyVec[] { new DummyVec { A = 0x3f800000u, B = 0x40000000u, C = 0x40400000u, D = 0xbf800000u }, new DummyVec { A = 0xbf800000u, B = 0xc0000000u, C = 0xc0400000u, D = 0x3f800000u }, }; using (var src = MakeTestArray(dummies)) { var dst = src.Reinterpret <DummyVec, float>(); Assert.AreEqual(8, dst.Length); Assert.AreEqual(1.0f, dst[0]); Assert.AreEqual(2.0f, dst[1]); Assert.AreEqual(3.0f, dst[2]); Assert.AreEqual(-1.0f, dst[3]); Assert.AreEqual(-1.0f, dst[4]); Assert.AreEqual(-2.0f, dst[5]); Assert.AreEqual(-3.0f, dst[6]); Assert.AreEqual(1.0f, dst[7]); } }
public unsafe void UnsafeUtility_AsRefAddressOfIn_Works() { DummyVec thing = default; void * thingInPtr = UnsafeUtilityExtensions.AddressOf(in thing); ref DummyVec thingRef = ref UnsafeUtilityExtensions.AsRef(in thing);