Skip to content

Commit 32b8d49

Browse files
committed
CodeGen - wip
1 parent f30099e commit 32b8d49

File tree

4 files changed

+4
-14
lines changed

4 files changed

+4
-14
lines changed

src/CodeGen/Gen.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@ namespace CodeGen;
55

66
public static class Gen
77
{
8-
public static string Join(int count, Func<int, string> part)
9-
{
10-
var sb = new StringBuilder();
11-
for (int i = 1; i <= count; i++) {
12-
sb.Append(part(i));
13-
}
14-
return sb.ToString();
15-
}
16-
178
public static string Join(int count, Func<int, string> part, string separator)
189
{
1910
var sb = new StringBuilder();

src/CodeGen/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static void Main(string[] args)
1111
{
1212
var dir = Path.GetFullPath("../../../../../src/ECS/", Directory.GetCurrentDirectory());
1313
Console.WriteLine($"Generate at: {dir}");
14-
for (int n = 2; n <= 3; n++)
14+
for (int n = 2; n <= 5; n++)
1515
{
1616
var iEach = QueryGen.IEach_generator(n);
1717
Write(dir, $"Query/Arg.{n}/IEach.txt", iEach);

src/CodeGen/Query/Query.Chunks.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public struct ChunkEnumerator<{{args}}> : IEnumerator<Chunks<{{args}}>>
9999
private readonly Archetypes archetypes; // 16
100100
//
101101
private int archetypePos; // 4
102-
private Chunks<{{args}}> chunks; // 46
102+
private Chunks<{{args}}> chunks;
103103
104104
105105
internal ChunkEnumerator(ArchetypeQuery<{{args}}> query)

src/CodeGen/Query/QueryJob.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,8 @@ public override void RunParallel()
110110
111111
private static int GetMultiple()
112112
{
113-
int lcm1 = StructPadding<T1>.ComponentMultiple;
114-
int lcm2 = StructPadding<T2>.ComponentMultiple;
115-
return LeastComponentMultiple(lcm1, lcm2);
113+
{{JoinLn(count, n => $" int lcm{n} = StructPadding<T{n}>.ComponentMultiple;")}}
114+
return LeastComponentMultipleOfSpan(stackalloc int[{{count}}] { {{Join(count, n => $"lcm{n}", ", ")}} });
116115
}
117116
}
118117

0 commit comments

Comments
 (0)