-////
-//// Local definitions
-////
-
-namespace {
-
- uint64_t book_key(const Position& pos) {
-
- uint64_t result = 0;
- Bitboard b = pos.occupied_squares();
-
- while (b)
- {
- Square s = pop_1st_bit(&b);
- result ^= book_piece_key(pos.piece_on(s), s);
- }
-
- result ^= book_castle_key(pos);
- result ^= book_ep_key(pos);
- result ^= book_color_key(pos);
- return result;
- }
-
-
- uint64_t book_piece_key(Piece p, Square s) {
-
- // Convert pieces to the range 0..11
- static const int PieceTo12[] = { 0, 0, 2, 4, 6, 8, 10, 0, 0, 1, 3, 5, 7, 9, 11 };
-
- return Random64[PieceIdx + (PieceTo12[int(p)]^1) * 64 + int(s)];
- }
-
-
- uint64_t book_castle_key(const Position& pos) {
-
- uint64_t result = 0;
-
- if (pos.can_castle_kingside(WHITE))
- result ^= Random64[CastleIdx + 0];
+/// Book::read_entry() takes an integer index, and returns the BookEntry
+/// at the given index in the book file.