X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitboard.h;h=3afbeedfbab42ee086000de51a4964350b34bea5;hp=bc3ed87b623dab6ae9debb5d89a48df9e3ee68ee;hb=49e110c52b19f5c99954d4797b8e991b0b60007c;hpb=1f40cd6d02374277abb5620d88d6fe58d7e9d6f7 diff --git a/src/bitboard.h b/src/bitboard.h index bc3ed87b..3afbeedf 100644 --- a/src/bitboard.h +++ b/src/bitboard.h @@ -319,4 +319,10 @@ extern Square pop_lsb(Bitboard* b); #endif +/// frontmost_sq() and backmost_sq() find the square corresponding to the +/// most/least advanced bit relative to the given color. + +inline Square frontmost_sq(Color c, Bitboard b) { return c == WHITE ? msb(b) : lsb(b); } +inline Square backmost_sq(Color c, Bitboard b) { return c == WHITE ? lsb(b) : msb(b); } + #endif // #ifndef BITBOARD_H_INCLUDED