mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Simplify generate_castle()
Skipping the calls to std::min(), std::man() we get even a nice speed-up on perft. No functional change.
This commit is contained in:
parent
834bd9edd7
commit
0dacab65eb
1 changed files with 2 additions and 4 deletions
|
@ -17,7 +17,6 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#include "movegen.h"
|
#include "movegen.h"
|
||||||
|
@ -47,9 +46,8 @@ namespace {
|
||||||
|
|
||||||
assert(!pos.in_check());
|
assert(!pos.in_check());
|
||||||
|
|
||||||
for (Square s = std::min(kfrom, kto), e = std::max(kfrom, kto); s <= e; s++)
|
for (Square s = kto; s != kfrom; s += (Square)(Side == KING_SIDE ? -1 : 1))
|
||||||
if ( s != kfrom // We are not in check
|
if (pos.attackers_to(s) & enemies)
|
||||||
&& (pos.attackers_to(s) & enemies))
|
|
||||||
return mlist;
|
return mlist;
|
||||||
|
|
||||||
// Because we generate only legal castling moves we need to verify that
|
// Because we generate only legal castling moves we need to verify that
|
||||||
|
|
Loading…
Add table
Reference in a new issue