summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/eval.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/eval.c b/src/eval.c
index eb6e118..63fd301 100755
--- a/src/eval.c
+++ b/src/eval.c
@@ -1149,6 +1149,16 @@ Return value:
PIECE p;
CHAR ch;
+ // g_SwapTable is only [14][32][32] (data.c) -- this is the bound
+ // that actually matters, not just "no garbage above bit 7" below.
+ // PAWN_BIT..KING_BIT briefly didn't fit in bits 0-4 earlier this
+ // session (when _WhoControlsSquareFast was converted to read them
+ // directly instead of going through the old ATTACK_BITV struct)
+ // and silently indexed out of bounds on every attacked square --
+ // the (& 0xFFFFFF00) checks below never caught it (board_
+ // representation/EVAL.md section 9).
+ ASSERT(uWhite < 32);
+ ASSERT(uBlack < 32);
ASSERT((uWhite & 0xFFFFFF00) == 0);
ASSERT((uBlack & 0xFFFFFF00) == 0);