32 lines
548 B
C
32 lines
548 B
C
|
#include "cellset.h"
|
||
|
|
||
|
|
||
|
void cellset_init(cellset_t* row) {
|
||
|
row->count = 0;
|
||
|
}
|
||
|
|
||
|
void cellset_add(
|
||
|
cellset_t* row,
|
||
|
uint8_t other
|
||
|
) {
|
||
|
for (uint8_t i = 0; i < row->count; i++) {
|
||
|
if (row->cells[i] == other) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (row->count >= N_CELLS) {
|
||
|
crash("too many interference items");
|
||
|
}
|
||
|
row->cells[row->count++] = other;
|
||
|
}
|
||
|
|
||
|
void cellset_add_exclude(
|
||
|
cellset_t* row,
|
||
|
uint8_t exclude,
|
||
|
uint8_t other
|
||
|
) {
|
||
|
if (other == exclude) { return; }
|
||
|
cellset_add(row, other);
|
||
|
}
|
||
|
|