ref: 209cd8cad2cddc322a7ad66c79503bf38025cd60
parent: 41d8139955e7a62a0ff57093f19451b5d26d3083
author: cancel <cancel@cancel.fm>
date: Sat Dec 1 10:18:52 EST 2018
Clean up loop hoisted ptrs
--- a/sim.c
+++ b/sim.c
@@ -827,13 +827,13 @@
static void sim_phase_0(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width,
Usz tick_number, Oper_bank_write_params* bank_params) {
for (Usz iy = 0; iy < height; ++iy) {
- Glyph* glyph_row = gbuf + iy * width;
+ Glyph const* glyph_row = gbuf + iy * width;
+ U8 const* mark_row = mbuf + iy * width;
for (Usz ix = 0; ix < width; ++ix) {
Glyph glyph_char = glyph_row[ix];
if (ORCA_LIKELY(glyph_char == '.'))
continue;
- U8 cell_flags = mbuffer_peek(mbuf, height, width, iy, ix) &
- (Mark_flag_lock | Mark_flag_sleep);
+ U8 cell_flags = mark_row[ix] & (Mark_flag_lock | Mark_flag_sleep);
switch (glyph_char) {
ORCA_SOLO_OPERATORS(SIM_EXPAND_SOLO_PHASE_0)
ORCA_DUAL_OPERATORS(SIM_EXPAND_DUAL_PHASE_0)
@@ -845,13 +845,13 @@
static void sim_phase_1(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width,
Usz tick_number, Oper_bank_read_params* bank_params) {
for (Usz iy = 0; iy < height; ++iy) {
- Glyph* glyph_row = gbuf + iy * width;
+ Glyph const* glyph_row = gbuf + iy * width;
+ U8 const* mark_row = mbuf + iy * width;
for (Usz ix = 0; ix < width; ++ix) {
Glyph glyph_char = glyph_row[ix];
if (ORCA_LIKELY(glyph_char == '.'))
continue;
- if (mbuffer_peek(mbuf, height, width, iy, ix) &
- (Mark_flag_lock | Mark_flag_sleep))
+ if (mark_row[ix] & (Mark_flag_lock | Mark_flag_sleep))
continue;
switch (glyph_char) {
ORCA_SOLO_OPERATORS(SIM_EXPAND_SOLO_PHASE_1)