X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fevaluate.cpp;h=3b70a950a66db5ee16f9f28e050b80b5864450b0;hp=8a5b6618851a8b33745e324d305a822ac2bb4d9e;hb=2c1ba2ab0dad2421b8ed1bd3c049634f1f00dfc3;hpb=b9bc6e823f061753419e563c4f923e60bd8c6193 diff --git a/src/evaluate.cpp b/src/evaluate.cpp index 8a5b6618..3b70a950 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -582,7 +582,7 @@ Value do_evaluate(const Position& pos, Value& margin) { assert(b); if (!more_than_one(b) && (b & pos.pieces(Them))) - score += ThreatBonus[Piece][type_of(pos.piece_on(first_1(b)))]; + score += ThreatBonus[Piece][type_of(pos.piece_on(lsb(b)))]; } // Decrease score if we are attacked by an enemy pawn. Remaining part @@ -870,7 +870,7 @@ Value do_evaluate(const Position& pos, Value& margin) { return SCORE_ZERO; do { - Square s = pop_1st_bit(&b); + Square s = pop_lsb(&b); assert(pos.pawn_is_passed(Us, s)); @@ -976,8 +976,8 @@ Value do_evaluate(const Position& pos, Value& margin) { while (b) { - s = pop_1st_bit(&b); - queeningSquare = relative_square(c, make_square(file_of(s), RANK_8)); + s = pop_lsb(&b); + queeningSquare = relative_square(c, file_of(s) | RANK_8); queeningPath = forward_bb(c, s); // Compute plies to queening and check direct advancement @@ -1017,10 +1017,10 @@ Value do_evaluate(const Position& pos, Value& margin) { while (b) { - s = pop_1st_bit(&b); + s = pop_lsb(&b); // Compute plies from queening - queeningSquare = relative_square(loserSide, make_square(file_of(s), RANK_8)); + queeningSquare = relative_square(loserSide, file_of(s) | RANK_8); movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(loserSide, s) == RANK_2); pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move()); @@ -1039,12 +1039,12 @@ Value do_evaluate(const Position& pos, Value& margin) { while (b) { - s = pop_1st_bit(&b); + s = pop_lsb(&b); sacptg = blockersCount = 0; minKingDist = kingptg = 256; // Compute plies from queening - queeningSquare = relative_square(loserSide, make_square(file_of(s), RANK_8)); + queeningSquare = relative_square(loserSide, file_of(s) | RANK_8); movesToGo = rank_distance(s, queeningSquare) - int(relative_rank(loserSide, s) == RANK_2); pliesToGo = 2 * movesToGo - int(loserSide == pos.side_to_move()); @@ -1058,7 +1058,7 @@ Value do_evaluate(const Position& pos, Value& margin) { // How many plies does it take to remove all the blocking pawns? while (blockers) { - blockSq = pop_1st_bit(&blockers); + blockSq = pop_lsb(&blockers); movesToGo = 256; // Check pawns that can give support to overcome obstacle, for instance @@ -1069,7 +1069,7 @@ Value do_evaluate(const Position& pos, Value& margin) { while (b2) // This while-loop could be replaced with LSB/MSB (depending on color) { - d = square_distance(blockSq, pop_1st_bit(&b2)) - 2; + d = square_distance(blockSq, pop_lsb(&b2)) - 2; movesToGo = std::min(movesToGo, d); } } @@ -1079,7 +1079,7 @@ Value do_evaluate(const Position& pos, Value& margin) { while (b2) // This while-loop could be replaced with LSB/MSB (depending on color) { - d = square_distance(blockSq, pop_1st_bit(&b2)) - 2; + d = square_distance(blockSq, pop_lsb(&b2)) - 2; movesToGo = std::min(movesToGo, d); }