Esempio n. 1
0
        public static Span256 <T> Load <T>(ref T src, int minlen)
            where T : struct
        {
            var bz  = BlockCount <T>(minlen, out int remainder);
            var bl  = BlockLength <T>();
            var len = remainder == 0 ? bz * bl : (bz + 1) * bl;

            return(Span256 <T> .LoadAligned(ref src, len));
        }
Esempio n. 2
0
        public static Span256 <T> Load <T>(ReadOnlySpan <T> src)
            where T : struct
        {
            var bz = BlockCount <T>(src.Length, out int remainder);

            if (remainder == 0)
            {
                return(Span256 <T> .LoadAligned(src.Replicate()));
            }
            else
            {
                var dst = AllocBlocks <T>(bz + 1);
                src.CopyTo(dst);
                return(dst);
            }
        }