Fix masking of the right-hand side.

The `SCANBIT` macro was not using `row` and `col` properly: if either was
anything else than a number (such as `col - 8`), the macro did not expand them
correctly, preserving operator precedence. As such, the right-hand side SCANBITs
were broken when used with masking, because the masking code uses `SCANBIT(row,
col - 8)`, and the `(7 - col)` part would expand to `(7 - col - 8)` which is
very different than `(7 - (col - 8))`.

This patch addresses the issue.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>
pull/365/head
Gergely Nagy 7 years ago
parent 3571a56ae6
commit 0a566eb58f

@ -58,7 +58,7 @@ class Model01 {
static uint32_t rightHandMask;
};
#define SCANBIT(row,col) ((uint32_t)1 << (row * 8 + (7 - col)))
#define SCANBIT(row,col) ((uint32_t)1 << ((row) * 8 + (7 - (col))))
#define R0C0 SCANBIT(0, 0)
#define R0C1 SCANBIT(0, 1)

Loading…
Cancel
Save