Closed sengerts closed 3 years ago
Can I jsut use a wrapping_shr on the usize value or will this differ from the intended semantics?
Looks like usize
has less than 64 bits on your platform. The intention is to do the shift first in u64
, then cast to usize:
(u64::wrapping_mul(
(occupied & ROOK_MAGICS.masks[s.0 as usize]).0,
ROOK_MAGICS.magics[s.0 as usize]
) >> (64-12)) as usize
Yes, this looks like a bug, and @niklasf 's fix seems correct.
Thank you both! I have forked the repo and created a pull request.
I am getting the following errors in the bitboard module while compiling the source code:
The code affected by these errors is the following:
Do you know why this error occurs or what I can do to fix the overflow?