I call
bitboard_print(0xFF);
void bitboard_print(const uint64 bitboard) {
sintx rank;
sintx file;
for (rank=SQUARE_RANK8; rank >= SQUARE_RANK1; rank--) {
for (file=SQUARE_FILEA; file <= SQUARE_FILEH; file++) {
if (bitboard & bitboard_from_file_rank(file, rank))
printf_s("x");
else
printf_s("-");
}
printf_s("\n");
}
printf_s("\n");
}
and I get
--------
--------
--------
xxxxxxxx
--------
--------
--------
xxxxxxxx
in Release mode. In Debug mode I get the right bitboard?!?!
What is the problem?
I call
bitboard_print(0xFF);
void bitboard_print(const uint64 bitboard) {
sintx rank;
sintx file;
for (rank=SQUARE_RANK8; rank >= SQUARE_RANK1; rank--) {
for (file=SQUARE_FILEA; file <= SQUARE_FILEH; file++) {
if (bitboard & bitboard_from_file_rank(file, rank))
printf_s("x");
else
printf_s("-");
}
printf_s("\n");
}
printf_s("\n");
}
and I get
--------
--------
--------
xxxxxxxx
--------
--------
--------
xxxxxxxx
in Release mode. In Debug mode I get the right bitboard?!?!
What is the problem?
perhaps call with bitboard_print(uint64(0xFF));
Richard.
Your compiler is using the 32 bit version of the left shift, but I can't reproduce this behavior with MS Visual C++, which is the only compiler I can use right now. If using gcc make sure the compiler understand that "1" require a 64-bit shift, e.g. by explicitly using (1 ULL).
Like Alessandro mentioned, for some weird reason the variable left shift amount is modulo 32. I would try this, note that (file + 8*rank) is only one lea ecx instruction...