]> git.sesse.net Git - stockfish/commitdiff
Clean up RootMove less operator
authormstembera <MissingEmail@email>
Mon, 16 Nov 2015 23:39:11 +0000 (15:39 -0800)
committerJoona Kiiski <joona@zoox.com>
Sat, 21 Nov 2015 07:30:07 +0000 (23:30 -0800)
This is used by std::stable_sort() to sort moves from highest score to lowest score.

1) The comment is incorrect since highest to lowest means descending.
2) It's more natural to implement a less operator using another less operator rather than a greater operator.

No functional change.

Resolves #504

src/search.h

index 96c0a2d17a476ed42859067d2d29e44b99e7090c..d755f1c2e873cf907d4c13d7af6812065f9c7714 100644 (file)
@@ -56,7 +56,7 @@ struct RootMove {
 
   explicit RootMove(Move m) : pv(1, m) {}
 
-  bool operator<(const RootMove& m) const { return score > m.score; } // Ascending sort
+  bool operator<(const RootMove& m) const { return m.score < score; } // Descending sort
   bool operator==(const Move& m) const { return pv[0] == m; }
   void insert_pv_in_tt(Position& pos);
   bool extract_ponder_from_tt(Position& pos);