Beispiel #1
0
 public static Span256 <T> Alloc <T>(int minlen, T?fill = null)
     where T : struct
 {
     Span256.Alignment <T>(minlen, out int blocklen, out int fullBlocks, out int remainder);
     if (remainder == 0)
     {
         return(AllocBlocks <T>(fullBlocks, fill));
     }
     else
     {
         return(Span256.AllocBlocks <T>(fullBlocks + 1, fill));
     }
 }
Beispiel #2
0
        public static Span256 <T> Alloc <N, T>(T?fill = null)
            where N : ITypeNat, new()
            where T : struct
        {
            var dataLen = nati <N>();

            Span256.Alignment <T>(dataLen, out int blocklen, out int fullBlocks, out int remainder);
            if (remainder == 0)
            {
                return(AllocBlocks <T>(fullBlocks));
            }
            else
            {
                return(AllocBlocks <T>(fullBlocks + 1));
            }
        }