- if(square_rank(p.pawnSquare) < RANK_7) {
- s = p.pawnSquare + DELTA_N;
- switch(Bitbase[compute_index(p.whiteKingSquare, p.blackKingSquare, s,
- BLACK)]) {
- case RESULT_LOSS:
- return RESULT_WIN;
-
- case RESULT_UNKNOWN:
- unknownFound = true;
- break;
-
- case RESULT_DRAW: case RESULT_INVALID:
- break;
-
- default:
- assert(false);
- }
-
- if(square_rank(s) == RANK_3 &&
- s != p.whiteKingSquare && s != p.blackKingSquare) {
- s += DELTA_N;
- switch(Bitbase[compute_index(p.whiteKingSquare, p.blackKingSquare, s,
- BLACK)]) {
- case RESULT_LOSS:
- return RESULT_WIN;
-
- case RESULT_UNKNOWN:
- unknownFound = true;
- break;
-
- case RESULT_DRAW: case RESULT_INVALID:
- break;
-
- default:
- assert(false);
+ if (square_rank(pos.pawnSquare) < RANK_7)
+ {
+ s = pos.pawnSquare + DELTA_N;
+ r = bb[compute_index(pos.whiteKingSquare, pos.blackKingSquare, s, BLACK)];
+
+ if (r == RESULT_LOSS)
+ return RESULT_WIN;
+
+ if (r == RESULT_UNKNOWN)
+ unknownFound = true;
+
+ // Double pawn push
+ if ( square_rank(s) == RANK_3
+ && s != pos.whiteKingSquare
+ && s != pos.blackKingSquare)
+ {
+ s += DELTA_N;
+ r = bb[compute_index(pos.whiteKingSquare, pos.blackKingSquare, s, BLACK)];
+
+ if (r == RESULT_LOSS)
+ return RESULT_WIN;
+
+ if (r == RESULT_UNKNOWN)
+ unknownFound = true;