示例#1
0
        public void Creator()
        {
            var local = arr;

            for (int i = 0; i < local.Length; i++)
            {
                local[i] = MyVector4.Create(i, i, i, i);
            }
        }
示例#2
0
        public void Constructor()
        {
            var local = arr;

            for (int i = 0; i < local.Length; i++)
            {
                local[i] = new MyVector4(i, i, i, i);
            }
        }
        static unsafe float Length_Sse_V6_Helper(MyVector4 vec)
        {
            var mmx = *((Vector128 <float> *) & vec);

            mmx = Sse41.DotProduct(mmx, mmx, 0xF1);
            var l2 = mmx.GetElement(0);

            return(MathF.Sqrt(l2));
        }
        public static MyVector4 Create(float x, float y, float z, float w)
        {
            var vec = new MyVector4();

            vec.X = x;
            vec.Y = y;
            vec.Z = z;
            vec.W = w;
            return(vec);
        }
        public CodeGenTests()
        {
            var rnd1 = new Random(1);

            for (int i = 0; i < arr.Length; i++)
            {
                arr[i] = new MyVector4((float)rnd1.NextDouble(), (float)rnd1.NextDouble(), (float)rnd1.NextDouble(), (float)rnd1.NextDouble());
            }
            test = Vec4Length_Reference();
        }
        static unsafe float Length_Sse_V2_Helper(MyVector4 vec)
        {
            var ptr = (float *)&vec;
            var mmx = Sse.LoadVector128(ptr);

            mmx = Sse41.DotProduct(mmx, mmx, 0xF1);
            var l2 = mmx.GetElement(0);

            return(MathF.Sqrt(l2));
        }