X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fbitbase.cpp;h=4170952b5607fd5625ecf34e6bfc4991ff109900;hp=510d305b50f76c66f7d96f876cd6c25de8068672;hb=e0504ab876a997321102f040ab88203cb893db12;hpb=60beb18efcb3c19b36a164a50e32b6ba6e24e7c4 diff --git a/src/bitbase.cpp b/src/bitbase.cpp index 510d305b..4170952b 100644 --- a/src/bitbase.cpp +++ b/src/bitbase.cpp @@ -2,6 +2,7 @@ Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2015 Marco Costalba, Joona Kiiski, Tord Romstad + Copyright (C) 2015-2016 Marco Costalba, Joona Kiiski, Gary Linscott, Tord Romstad Stockfish is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -53,7 +54,7 @@ namespace { WIN = 4 }; - inline Result& operator|=(Result& r, Result v) { return r = Result(r | v); } + Result& operator|=(Result& r, Result v) { return r = Result(r | v); } struct KPKPosition { KPKPosition() = default; @@ -122,9 +123,9 @@ namespace { // Immediate win if a pawn can be promoted without getting captured else if ( us == WHITE && rank_of(psq) == RANK_7 - && ksq[us] != psq + DELTA_N - && ( distance(ksq[~us], psq + DELTA_N) > 1 - || (StepAttacksBB[KING][ksq[us]] & (psq + DELTA_N)))) + && ksq[us] != psq + NORTH + && ( distance(ksq[~us], psq + NORTH) > 1 + || (StepAttacksBB[KING][ksq[us]] & (psq + NORTH)))) result = WIN; // Immediate draw if it is a stalemate or a king captures undefended pawn @@ -165,12 +166,12 @@ namespace { if (Us == WHITE) { if (rank_of(psq) < RANK_7) // Single push - r |= db[index(Them, ksq[Them], ksq[Us], psq + DELTA_N)]; + r |= db[index(Them, ksq[Them], ksq[Us], psq + NORTH)]; if ( rank_of(psq) == RANK_2 // Double push - && psq + DELTA_N != ksq[Us] - && psq + DELTA_N != ksq[Them]) - r |= db[index(Them, ksq[Them], ksq[Us], psq + DELTA_N + DELTA_N)]; + && psq + NORTH != ksq[Us] + && psq + NORTH != ksq[Them]) + r |= db[index(Them, ksq[Them], ksq[Us], psq + NORTH + NORTH)]; } return result = r & Good ? Good : r & UNKNOWN ? UNKNOWN : Bad;