Skip to content

Commit

Permalink
Fix a warning with MSVC in 'analyze' mode
Browse files Browse the repository at this point in the history
Here MSVC is worried that

StepAttacksBB[PAWN][psq]

could overflow, so change psq initialization
to clarify psq is always less than 64.

No functional change.
  • Loading branch information
mcostalba committed Jun 14, 2014
1 parent 2cb4c70 commit c6fc51c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/bitbase.cpp
Expand Up @@ -107,11 +107,11 @@ namespace {

KPKPosition::KPKPosition(unsigned idx) {

wksq = Square((idx >> 0) & 0x3F);
bksq = Square((idx >> 6) & 0x3F);
us = Color ((idx >> 12) & 0x01);
psq = make_square(File((idx >> 13) & 0x03), Rank(RANK_7 - (idx >> 15)));
result = UNKNOWN;
wksq = Square((idx >> 0) & 0x3F);
bksq = Square((idx >> 6) & 0x3F);
us = Color ((idx >> 12) & 0x01);
psq = make_square(File((idx >> 13) & 0x3), RANK_7 - Rank((idx >> 15) & 0x7));
result = UNKNOWN;

// Check if two pieces are on the same square or if a king can be captured
if ( square_distance(wksq, bksq) <= 1
Expand Down

0 comments on commit c6fc51c

Please sign in to comment.