51 if (debug::channels::dc::countboard.is_on())
54 libcwd::location_ct location((
char*)__builtin_return_address(0) + libcwd::builtin_return_address_offset);
56 std::string demangled_function_name;
57 libcwd::demangle_symbol(location.mangled_function_name(), demangled_function_name);
59 Dout(dc::countboard,
"CountBoard::add() with this = " << (
void*)
this <<
" [called from " << demangled_function_name <<
'(' << location <<
")], adds:");
60 for (
int row = 7; row >= 0; --row)
62 for (
int col = 0; col <= 7; ++col)
64 if (bit_board.
test(col, row))
76 BitBoard bits_and1(M_bits[0] & input);
78 BitBoard bits_and2(M_bits[1] & bits_and1);
79 M_bits[1] ^= bits_and1;
80 bits_and1 = M_bits[2] & bits_and2;
81 M_bits[2] ^= bits_and2;
82 M_bits[3] ^= bits_and1;
88 if (debug::channels::dc::countboard.is_on())
91 libcwd::location_ct location((
char*)__builtin_return_address(0) + libcwd::builtin_return_address_offset);
93 std::string demangled_function_name;
94 libcwd::demangle_symbol(location.mangled_function_name(), demangled_function_name);
96 Dout(dc::countboard,
"CountBoard::sub() with this = " << (
void*)
this <<
" [called from " << demangled_function_name <<
'(' << location <<
")], subtracts:");
97 for (
int row = 7; row >= 0; --row)
99 for (
int col = 0; col <= 7; ++col)
101 if (bit_board.
test(col, row))
112 BitBoard bits_and1(~M_bits[0] & input);
113 BitBoard collect(M_bits[0] ^= input);
114 BitBoard bits_and2(~M_bits[1] & bits_and1);
115 collect |= (M_bits[1] ^= bits_and1);
116 bits_and1 = ~M_bits[2] & bits_and2;
117 collect |= (M_bits[2] ^= bits_and2);
118 collect |= (M_bits[3] ^= bits_and1);
125 #if DEBUG_BITBOARD_INITIALIZATION 134 BitBoard any(
void)
const {
return M_any; }
136 int count(
BitBoard const& pos)
const 138 return ((M_bits[0] & pos) ? 1 : 0) | ((M_bits[1] & pos) ? 2 : 0) | ((M_bits[2] & pos) ? 4 : 0) | ((M_bits[3] & pos) ? 8 : 0);
141 int count(
Index const& index)
const 150 #endif // COUNTBOARD_H A namespace for all chess related objects that are not related to the GUI.
A one-boolean-per-square chessboard.
The index of a chess square.
bool test() const
Test if any bit is set at all.
This file contains the declaration of class BitBoard.
void reset()
Set all values to FALSE.