コード例 #1
0
    public static unsafe int test_0_cpblk()
    {
        byte *dest = stackalloc byte [20];
        byte *src  = stackalloc byte [20];

        for (int i = 0; i < 20; ++i)
        {
            src [i] = (byte)i;
        }


        Intrinsics.UnalignedCpblk(dest + 0, src + 0, 2);
        if (dest [0] != src [0] || dest [1] != src [1])
        {
            return(1);
        }

        Intrinsics.UnalignedCpblk(dest + 1, src + 0, 2);
        if (dest [1] != src [0] || dest [2] != src [1])
        {
            return(2);
        }

        Intrinsics.UnalignedCpblk(dest + 0, src + 1, 2);
        if (dest [0] != src [1] || dest [1] != src [2])
        {
            return(3);
        }

        Intrinsics.UnalignedCpblk(dest + 1, src + 1, 2);
        if (dest [1] != src [1] || dest [2] != src [2])
        {
            return(3);
        }

        Intrinsics.UnalignedCpblk(dest + 1, src + 1, 4);
        for (int i = 0; i < 4; ++i)
        {
            if (dest [i + 1] != src [i + 1])
            {
                return(4);
            }
        }

        Intrinsics.UnalignedCpblk(dest + 1, src + 1, 8);
        for (int i = 0; i < 8; ++i)
        {
            if (dest [i + 1] != src [i + 1])
            {
                return(5);
            }
        }

        return(0);
    }