. . . . . . X X
X X X . X . . .
X X . X X X X .
. . . . X . X .
. X X . X X X X
X X X X X X X .
. . . . . . . .
. . . . . . . .
BitBoard::to_square creates an out of bounds Square(64) on an empty bitboard. This can be used to access out of bounds memory.
Another somewhat irrelevant thing that can be considered is making Square an enum instead. This would allow the compiler to automatically elide all bounds checks when indexing by Squares. It would allow it to be used for niche space optimizations.
prints garbage:
BitBoard::to_square
creates an out of boundsSquare(64)
on an empty bitboard. This can be used to access out of bounds memory. Another somewhat irrelevant thing that can be considered is makingSquare
anenum
instead. This would allow the compiler to automatically elide all bounds checks when indexing bySquare
s. It would allow it to be used for niche space optimizations.