- typedef unsigned (Fn)(Square, Bitboard);
-
- void init_magics(Bitboard table[], Bitboard* attacks[], Bitboard magics[],
- Bitboard masks[], unsigned shifts[], Square deltas[], Fn index);
-
- // bsf_index() returns the index into BSFTable[] to look up the bitscan. Uses
- // Matt Taylor's folding for 32 bit case, extended to 64 bit by Kim Walisch.
-
- unsigned bsf_index(Bitboard b) {
- b ^= b - 1;
- return Is64Bit ? (b * DeBruijn64) >> 58
- : ((unsigned(b) ^ unsigned(b >> 32)) * DeBruijn32) >> 26;
- }
-