ref: 1bc8d428df2e6819e5ea387f3a647c5b947fea22
parent: 1396a4d6e3b69ac2ae59899a0295a302464cab40
author: cancel <cancel@cancel.fm>
date: Sat Dec 1 11:39:16 EST 2018
Add typedef alias for U8 -> Mark
--- a/base.h
+++ b/base.h
@@ -78,6 +78,7 @@
typedef ssize_t Isz;
typedef char Glyph;
+typedef U8 Mark;
typedef Glyph* Gbuffer;
--- a/mark.h
+++ b/mark.h
@@ -10,7 +10,7 @@
Mark_flag_sleep = 1 << 4,
} Mark_flags;
-typedef U8* Mbuffer;
+typedef Mark* Mbuffer;
typedef struct Markmap_reusable {
Mbuffer buffer;
@@ -63,7 +63,7 @@
static void mbuffer_poke_flags_or(Mbuffer map, Usz map_height, Usz map_width,
Usz y, Usz x, Mark_flags flags) {
(void)map_height;
- map[y * map_width + x] |= (U8)flags;
+ map[y * map_width + x] |= (Mark)flags;
}
ORCA_OK_IF_UNUSED
@@ -75,5 +75,5 @@
Isz x0 = (Isz)x + offs_x;
if (y0 >= (Isz)map_height || x0 >= (Isz)map_width || y0 < 0 || x0 < 0)
return;
- map[(Usz)y0 * map_width + (Usz)x0] |= (U8)flags;
+ map[(Usz)y0 * map_width + (Usz)x0] |= (Mark)flags;
}
--- a/sim.c
+++ b/sim.c
@@ -162,7 +162,7 @@
Usz const width, Usz const y, Usz const x, Usz Tick_number
#define OPER_PHASE_0_COMMON_ARGS \
OPER_PHASE_COMMON_ARGS, Oper_bank_write_params *const bank_params, \
- U8 const cell_flags
+ Mark const cell_flags
#define OPER_PHASE_1_COMMON_ARGS \
OPER_PHASE_COMMON_ARGS, Oper_bank_read_params* const bank_params
@@ -622,10 +622,10 @@
Usz max_x = x + len;
if (max_x > width)
max_x = width;
- U8* i = mbuffer + y * width + x + 1;
- U8* e = mbuffer + y * width + max_x;
+ Mark* i = mbuffer + y * width + x + 1;
+ Mark* e = mbuffer + y * width + max_x;
while (i != e) {
- *i = (U8)(*i | Mark_flag_lock);
+ *i = (Mark)(*i | Mark_flag_lock);
++i;
}
}
@@ -830,12 +830,12 @@
Usz tick_number, Oper_bank_write_params* bank_params) {
for (Usz iy = 0; iy < height; ++iy) {
Glyph const* glyph_row = gbuf + iy * width;
- U8 const* mark_row = mbuf + iy * width;
+ Mark 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 = mark_row[ix] & (Mark_flag_lock | Mark_flag_sleep);
+ Mark 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)
@@ -848,7 +848,7 @@
Usz tick_number, Oper_bank_read_params* bank_params) {
for (Usz iy = 0; iy < height; ++iy) {
Glyph const* glyph_row = gbuf + iy * width;
- U8 const* mark_row = mbuf + iy * width;
+ Mark const* mark_row = mbuf + iy * width;
for (Usz ix = 0; ix < width; ++ix) {
Glyph glyph_char = glyph_row[ix];
if (ORCA_LIKELY(glyph_char == '.'))