mobility: Do not update mobility if not enabled

The performance improvement is 1%-2%.
This commit is contained in:
Calcitem 2021-06-15 22:41:20 +08:00
parent 48a28c74bb
commit 7bc437c367
1 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "position.h"
#include "thread.h"
#include "mills.h"
#include "option.h"
using std::string;
@ -1356,6 +1357,10 @@ void Position::reset_bb()
void Position::updateMobility(MoveType mt, Square s)
{
if (!gameOptions.getConsiderMobility()) {
return;
}
Bitboard adjacentWhiteBB = byColorBB[WHITE] & MoveList<LEGAL>::adjacentSquaresBB[s];
Bitboard adjacentBlackBB = byColorBB[BLACK] & MoveList<LEGAL>::adjacentSquaresBB[s];
Bitboard adjacentNoColorBB = (~(byColorBB[BLACK] | byColorBB[WHITE])) & MoveList<LEGAL>::adjacentSquaresBB[s];