示例#1
0
文件: tv_max.cs 项目: 0xCM/arrows
        public void max128_i32()
        {
            var blocklen = Span128 <int> .BlockLength;
            var lhs      = Random.ReadOnlySpan128 <int>(SampleSize);
            var rhs      = Random.ReadOnlySpan128 <int>(SampleSize);
            var expect   = Span128.AllocBlocks <int>(SampleSize);
            var actual   = Span128.AllocBlocks <int>(SampleSize);

            for (var block = 0; block < SampleSize; block++)
            {
                var offset = block * blocklen;

                Span <int> tmp = stackalloc int[blocklen];
                for (var i = 0; i < blocklen; i++)
                {
                    tmp[i] = gmath.max(lhs[offset + i], rhs[offset + i]);
                }
                var vExpect = Vec128.LoadVector(ref tmp[0]);

                var vX      = lhs.LoadVec128(block);
                var vY      = rhs.LoadVec128(block);
                var vActual = ginx.max <int>(vX, vY);

                Claim.eq(vExpect, vActual);

                vstore(vExpect, ref expect.Block(block));
                vstore(vActual, ref actual.Block(block));
            }
            Claim.eq(expect, actual);
        }
示例#2
0
        public void Fill2()
        {
            var blockX = Span128.AllocBlocks <int>(1);

            blockX[0] = 1;
            blockX[1] = 2;
            blockX[2] = 3;
            blockX[3] = 4;

            var blockY = Span128.Load(blockX.Unblock());

            Claim.eq(blockX, blockY);
        }
示例#3
0
        public void Fill1()
        {
            var blocks   = Pow2.T08;
            var blocklen = Span128 <int> .BlockLength;
            var src      = Random.ReadOnlySpan128 <int>(blocks);
            var dst      = Span128.AllocBlocks <int>(blocks);

            Claim.eq(src.Length, dst.Length);

            for (int block = 0, idx = 0; block < blocks; block++, idx++)
            {
                for (var i = 0; i < blocklen; i++)
                {
                    dst[block * blocklen + i] = src[block * blocklen + i];
                }
            }

            src.ClaimEqual(dst);
        }