ref: b12aa3810c864d0869c80711fbbeea512c61e9d0
parent: da0d05078bc663b957b04318e1e9cccb7ee3942c
author: cancel <cancel@cancel.fm>
date: Mon Nov 26 08:35:17 EST 2018
Split out phase steps into separate procedures Will make it easier to debug in the future
--- a/sim.c
+++ b/sim.c
@@ -201,9 +201,7 @@
OPER_PHASE_2(bang)
OPER_END
-void orca_run(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width) {
- mbuffer_clear(mbuf, height, width);
- // Phase 0
+static void sim_phase_0(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width) {
for (Usz iy = 0; iy < height; ++iy) {
Glyph* glyph_row = gbuf + iy * width;
for (Usz ix = 0; ix < width; ++ix) {
@@ -220,7 +218,9 @@
}
}
}
- // Phase 1
+}
+
+static void sim_phase_1(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width) {
for (Usz iy = 0; iy < height; ++iy) {
Glyph* glyph_row = gbuf + iy * width;
for (Usz ix = 0; ix < width; ++ix) {
@@ -237,4 +237,10 @@
}
}
}
+}
+
+void orca_run(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width) {
+ mbuffer_clear(mbuf, height, width);
+ sim_phase_0(gbuf, mbuf, height, width);
+ sim_phase_1(gbuf, mbuf, height, width);
}