]> git.sesse.net Git - stockfish/blobdiff - src/move.h
Micro optimize move_is_ep() and move_is_castle()
[stockfish] / src / move.h
index e9f7242696c9abf0fa477758b192c47f4ace9dcb..2afba6a37ae0e8ceb67c697e0cadc8388ff980bd 100644 (file)
@@ -62,6 +62,9 @@ struct MoveStack {
   int score;
 };
 
+// Note that operator< is set up such that std::sort() will sort in descending order
+inline bool operator<(const MoveStack& f, const MoveStack& s) { return s.score < f.score; }
+
 
 ////
 //// Inline functions
@@ -80,11 +83,11 @@ inline PieceType move_promotion(Move m) {
 }
 
 inline bool move_is_ep(Move m) {
-  return bool((int(m) >> 15) & 1);
+  return bool(m & (1 << 15));
 }
 
 inline bool move_is_castle(Move m) {
-  return bool((int(m) >> 16) & 1);
+  return bool(m & (1 << 16));
 }
 
 inline bool move_is_short_castle(Move m) {