]> git.sesse.net Git - stockfish/blobdiff - src/bitboard.h
Fix random moves when time < 10ms
[stockfish] / src / bitboard.h
index bc3ed87b623dab6ae9debb5d89a48df9e3ee68ee..3afbeedfbab42ee086000de51a4964350b34bea5 100644 (file)
@@ -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