9 ms·
It may be slightly faster to break the table into two and encode as 2 8-bit values. Each eight bit value can store the value of 5 cells. So two can encode the w
by kevincox 3y ago
It may be slightly faster to break the table into two and encode as 2 8-bit values. Each eight bit value can store the value of 5 cells. So two can encode the whole board (with one extra cell to use as you please).
And if this is a hot part of the code a lookup table for 256 values may be a speedup and is very manageable. Especially if you compress it to 128 bytes (although that may lose the performance you were after, calculating how much cache is worth using is a hard problem).