public static unsafe void TestFixed4096CopyToStackAlloc0(ref Fixed4096 a, ref Fixed4096 b)
        {
            Fixed4096 *c = stackalloc Fixed4096[1];

            c->First[4] = 42;
            a           = *c;
        }
 public static unsafe void TestFixed4096ManualCopy(ref Fixed4096 a, ref Fixed4096 b)
 {
     for (int i = 0; i < UnsafeUtility.SizeOf <Fixed4096>(); i++)
     {
         a.First[i] = b.First[i];
     }
 }
        public static unsafe void TestFixed4096CopyToAlloca(ref Fixed4096 a, ref Fixed4096 b)
        {
            Fixed4096 c = b;

            c.First[4] = 42;
            a          = c;
        }
Beispiel #4
0
        public static unsafe void TestGetSetStructThroughReadWriteArrayElement(ref Fixed4096 a)
        {
            var ptr1 = UnsafeUtility.AddressOf(ref a);
            var ptr2 = (byte *)ptr1 + 1;

            UnsafeUtility.WriteArrayElement(ptr1, 0, UnsafeUtility.ReadArrayElement <Fixed1021>(ptr2, 0));
        }
        public static unsafe void TestFixed4096CopyToStackAlloc1(ref Fixed4096 a, ref Fixed4096 b)
        {
            byte *     bytes = stackalloc byte[4096];
            Fixed4096 *c     = (Fixed4096 *)bytes;

            c->First[4] = 42;
            a           = *c;
        }
        public static unsafe void TestSetStructThroughWriteArrayElement(ref Fixed4096 a, ref Fixed4096 b)
        {
            fixed(void *ptr = &a)
            {
                var elem = a;

                UnsafeUtility.WriteArrayElement(ptr, 0, elem);
            }
        }
        public static unsafe void TestGetStructThroughReadArrayElement(ref Fixed4096 a, ref Fixed4096 b)
        {
            fixed(void *ptr = &a)
            {
                var elem = UnsafeUtility.ReadArrayElement <Fixed4096>(ptr, 0);

                b = elem;
            }
        }
        public static unsafe void TestGetStructThroughGeneric(ref Fixed4096 a, ref Fixed4096 b)
        {
            fixed(void *ptr = &a)
            {
                var elem = GenericGetT <Fixed4096>((Fixed4096 *)ptr);

                b = elem;
            }
        }
        public static unsafe void TestPointersInStruct(ref PointersInStruct a, ref Fixed4096 b)
        {
            fixed(byte *ptr = b.First)
            {
                a.a = ptr;
            }

            a.b = a.a;
        }
        public static unsafe void TestGetSetStructThroughReadWriteArrayElementNoAlias(ref Fixed4096 a)
        {
            fixed(void *ptr1 = &a)
            {
                var ptr2 = (byte *)ptr1 + UnsafeUtility.SizeOf <Fixed1021>();

                UnsafeUtility.WriteArrayElement(ptr1, 0, UnsafeUtility.ReadArrayElement <Fixed1021>(ptr2, 0));
            }
        }
 public static unsafe void TestFixed4096(ref Fixed4096 a, ref Fixed4096 b)
 {
     a = b;
 }
Beispiel #12
0
        public static unsafe void TestSetStructThroughWriteArrayElement(ref Fixed4096 a, ref Fixed4096 b)
        {
            var elem = a;

            UnsafeUtility.WriteArrayElement(UnsafeUtility.AddressOf(ref b), 0, elem);
        }
Beispiel #13
0
        public static unsafe void TestGetStructThroughReadArrayElement(ref Fixed4096 a, ref Fixed4096 b)
        {
            var elem = UnsafeUtility.ReadArrayElement <Fixed4096>(UnsafeUtility.AddressOf(ref a), 0);

            b = elem;
        }
Beispiel #14
0
        public static unsafe void TestGetStructThroughGeneric(ref Fixed4096 a, ref Fixed4096 b)
        {
            var elem = GenericGetT <Fixed4096>((Fixed4096 *)UnsafeUtility.AddressOf(ref a));

            b = elem;
        }