Ejemplo n.º 1
0
 static void Scale(ref OuterStruct16 m, float s, out OuterStruct16 result)
 {
     result.X.X = m.X.X * s;
     result.X.Y = m.X.Y * s;
     result.Y.X = m.Y.X * s;
     result.Y.Y = m.Y.Y * s;
 }
Ejemplo n.º 2
0
        public static void Test()
        {
            {
                //Nested versus flattened tests
                var s8  = new OuterStruct8();
                var s16 = new OuterStruct16();
                var s   = 0f;
                OuterStruct8.Test(ref s8, s, out var result8);
                OuterStruct16.Test(ref s16, s, out var result16);

                var d = new DummyOuterStruct();
                DummyOuterStruct.Test(ref d, 0f, out var dResult);

                var f = new ScalarFlattenedStruct();
                ScalarFlattenedStruct.Test(ref f, s, out var flattenedResult);
            }

            {
                //Field count tests
                var i4  = new Int4();
                var i5  = new Int5();
                var l4  = new Long4();
                var l5  = new Long5();
                var vf4 = new VectorFloat4();
                var vf5 = new VectorFloat5();
                var s   = new Vector <float>();
                Int4.Test(ref i4, 0, out var i4result);
                Int5.Test(ref i5, 0, out var i5result);
                Long4.Test(ref l4, 0, out var l4result);
                Long5.Test(ref l5, 0, out var l5result);
                VectorFloat4.Test(ref vf4, ref s, out var vf4Result);
                VectorFloat5.Test(ref vf5, ref s, out var vf5Result);
            }

            {
                //Assignment-only tests
                var s16 = new DummyStruct16();
                var s32 = new DummyStruct32();
                var s48 = new DummyStruct48();
                var s64 = new DummyStruct64();
                var s80 = new DummyStruct80();
                DoDummies(ref s16, out var result16);
                DoDummies(ref s32, out var result32);
                DoDummies(ref s48, out var result48);
                DoDummies(ref s64, out var result64);
                DoDummies(ref s80, out var result80);
            }

            {
                TestScalarStruct();
                TestStruct();
                TestStructManuallyInlined();
                TestStructless();
            }
        }
Ejemplo n.º 3
0
 public static void Test(ref OuterStruct16 m, float s, out OuterStruct16 result)
 {
     //rep stos, ecx 4 (16 bytes)
     Scale(ref m, s, out var intermediate);
     Scale(ref intermediate, s, out result);
 }