From de02670685add14c80828f6d82061fe7171a594d Mon Sep 17 00:00:00 2001 From: jackjohn7 <70782491+jackjohn7@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:39:31 -0500 Subject: [PATCH] correct const mask names, correct doc comments about endianness --- src/board/mod.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/board/mod.rs b/src/board/mod.rs index eaf3202..1c19372 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -89,25 +89,24 @@ pub fn explode_board(mut b: Board) -> impl Iterator { // Positive => SHL // Negative => SHR // simply negating the A file -const NOT_A_FILE: Board = 0x7F7F7F7F7F7F7F7F; +const NOT_A_FILE: Board = 0xFEFEFEFEFEFEFEFE; // simply negating the H file -const NOT_H_FILE: Board = 0xFEFEFEFEFEFEFEFE; +const NOT_H_FILE: Board = 0x7F7F7F7F7F7F7F7F; const SHIFT_MASK_COMBOS: [(i8, Board); 8] = [ - (9, NOT_A_FILE), // 9 (up right) + (9, NOT_H_FILE), // 9 (up right) (8, Board::MAX), // 8 (up) - (7, NOT_H_FILE), // 7 (up left) - (1, NOT_A_FILE), // 1 (right) - (-1, NOT_H_FILE), // -1 (left) - (-7, NOT_A_FILE), // -7 (down right) + (7, NOT_A_FILE), // 7 (up left) + (1, NOT_H_FILE), // 1 (right) + (-1, NOT_A_FILE), // -1 (left) + (-7, NOT_H_FILE), // -7 (down right) (-8, Board::MAX), // -8 (down) - (-9, NOT_H_FILE), // -9 (down left) + (-9, NOT_A_FILE), // -9 (down left) ]; /// Represents the board state using two integers. This allows us to reduce the /// memory footprint by 75% when compared against using a byte[8][8] (64 -/// bytes). While digits in these boards do not have _place value_ per se, it -/// still may be helpful to think of the structure as being Big Endian and -/// by that I mean to say that h8 is the leftmost bit and a1 is the rightmost. +/// bytes). This structure is identical to what the Chess world identifies as +/// Little-Endian Rank-File _LERF_. /// /// The values are to be mapped as follows where each number indicates the bit /// in the integer that corresponds to the position in the board: @@ -126,8 +125,8 @@ const SHIFT_MASK_COMBOS: [(i8, Board); 8] = [ /// /// = /// -/// bits: 00 01 ... 07 08 09 ... 15 ... 56 57 ... 63 -/// board: a1 b1 ... h1 a2 b2 ... h2 ... a8 b8 ... h8 +/// bit: 00 01 ... 07 08 09 ... 15 ... 56 57 ... 63 +/// square: a1 b1 ... h1 a2 b2 ... h2 ... a8 b8 ... h8 /// ``` /// /// Note that I use the traditional nomenclature of ranks and files which