Ejemplo n.º 1
0
        unsafe static void Main(string[] args)
        {
            using (AlignedBlock block = new AlignedBlock(SIMDVector4.Sizeof, AlignedBlock.PageSize / SIMDVector4.Sizeof))
            {
                SIMDVector4 a = SIMDVector4.Create(block[0], 1, 2, 3, 4);
                SIMDVector4 b = SIMDVector4.Create(block[1], 1, 2, 3, 4);
                SIMDVector4 c = SIMDVector4.Create(block[2], 5, 6, 7, 8);
                SIMDVector4 d = a * b * c;
                Console.WriteLine(d.ToString());
            }

            Console.ReadLine();
        }
        public static SIMDVector4 Create(void *ptr, float x, float y, float z, float w)
        {
            float *value = (float *)ptr;

            SIMDVector4 vector = new SIMDVector4(value);

            *value = x;
            value++;
            *value = y;
            value++;
            *value = z;
            value++;
            *value = w;
            value++;
            return(vector);
        }
        unsafe static void Main(string[] args)
        {
            using (AlignedBlock block = new AlignedBlock(SIMDVector4.Sizeof, AlignedBlock.AllocationGranularity / SIMDVector4.Sizeof))
            {
                for (int index = 0; index < block.Count; index++)
                {
                    SIMDVector4.Create(block[index], 1, 2, 3, 4);
                }

                SIMDVector4 a = SIMDVector4.Create(block[0], 1, 2, 3, 4);
                SIMDVector4 b = SIMDVector4.Create(block[1], 1, 2, 3, 4);
                SIMDVector4 c = SIMDVector4.Create(block[2], 5, 6, 7, 8);
                SIMDVector4 d = a * b * c;
                Console.WriteLine(d.ToString());
            }

            Console.ReadLine();
        }