template<typename U64Type , std::size_t N>
| const U64Type & hoover_chess_utils::pgn_reader::turnSpecificArrayLookup |
( |
const std::array< std::array< U64Type, 2U >, N > & |
array, |
|
|
std::size_t |
i, |
|
|
Color |
turn |
|
) |
| |
|
inlinenoexcept |
Optimized lookup for arrays indexed by general index and turn (side-to-move).
- Template Parameters
-
| U64Type | 64-bit type, generally intended to be SquareSet or std::uint64_t |
| N | Array length in pairs of U64Type |
- Parameters
-
| [in] | array | Array of U64Type element pairs |
| [in] | i | Array index |
| [in] | turn | Side to move. Must be either Color::WHITE or Color::BLACK (asserted) |
- Returns
- Const reference to the element
The implementation makes a strong assumption that turn is one of { Color::WHITE, Color::BLACK }. This can eliminate otherwise superfluous arithmetic operations when computing the memory address. In particular, turn can be used as is as the array byte offset, instead of resetting the lowest 3 bits (i.e., byte_offset = (turn / 8) * 8).
template<typename U64Type >
| const U64Type & hoover_chess_utils::pgn_reader::turnSpecificLookup |
( |
const std::array< U64Type, 2U > & |
array, |
|
|
Color |
turn |
|
) |
| |
|
inlinenoexcept |
Piece attack tables.
Optimized lookup for arrays indexed by turn (side-to-move).
- Template Parameters
-
| U64Type | 64-bit type, generally intended to be SquareSet or std::uint64_t |
- Parameters
-
- Returns
- Const reference to the element
The expected array layout is
The implementation makes a strong assumption that turn is one of { Color::WHITE, Color::BLACK }. This can eliminate otherwise superfluous arithmetic operations when computing the memory address. In particular, turn can be used as is as the array byte offset, instead of resetting the lowest 3 bits (i.e., byte_offset = (turn / 8) * 8).