public static StructOfArrays <StructType> New(string name, int arrayLength)
        {
            var soa = new StructOfArrays <StructType>();

            soa.Name          = name;
            soa.Length        = arrayLength;
            soa._baseInstance = new StructType();
            return(soa);
        }
Esempio n. 2
0
 public static void ForEach <T>(IndexingRegister index, StructOfArrays <T> items, Action <T, LoopLabels> block) where T : Struct, new()
 {
     if (index is RegisterX)
     {
         AscendWhile(X.Set(0), () => X.NotEquals(items.Length == 256 ? 0 : items.Length), lblsX => {
             var before = X.State.Hash;
             block?.Invoke(items[X], lblsX);
             X.State.Verify(before);
         });
     }
     else
     {
         AscendWhile(Y.Set(0), () => Y.NotEquals(items.Length == 256 ? 0 : items.Length), lblsY => {
             var before = Y.State.Hash;
             block?.Invoke(items[Y], lblsY);
             Y.State.Verify(before);
         });
     }
 }