Skip to content

Commit

Permalink
fix some shift overflows in thordb.c
Browse files Browse the repository at this point in the history
  • Loading branch information
panstromek committed Feb 20, 2022
1 parent 7f6d045 commit 9a5b789
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions thordb.c
Original file line number Diff line number Diff line change
Expand Up @@ -2096,44 +2096,44 @@ database_search( int *in_board,
if ( in_board[pos] != EMPTY ) {
index = 8 * i + j;
if ( index < 32 )
shape_lo[0] |= (1 << index);
shape_lo[0] |= (1u << index);
else
shape_hi[0] |= (1 << (index - 32));
shape_hi[0] |= (1u << (index - 32));
index = 8 * i + (7 - j);
if ( index < 32 )
shape_lo[1] |= (1 << index);
shape_lo[1] |= (1u << index);
else
shape_hi[1] |= (1 << (index - 32));
shape_hi[1] |= (1u << (index - 32));
index = 8 * j + i;
if ( index < 32 )
shape_lo[2] |= (1 << index);
shape_lo[2] |= (1u << index);
else
shape_hi[2] |= (1 << (index - 32));
shape_hi[2] |= (1u << (index - 32));
index = 8 * j + (7 - i);
if ( index < 32 )
shape_lo[3] |= (1 << index);
shape_lo[3] |= (1u << index);
else
shape_hi[3] |= (1 << (index - 32));
shape_hi[3] |= (1u << (index - 32));
index = 8 * (7 - i) + j;
if ( index < 32 )
shape_lo[4] |= (1 << index);
shape_lo[4] |= (1u << (index));
else
shape_hi[4] |= (1 << (index - 32));
shape_hi[4] |= (1u << (index - 32));
index = 8 * (7 - i) + (7 - j);
if ( index < 32 )
shape_lo[5] |= (1 << index);
shape_lo[5] |= (1u << index);
else
shape_hi[5] |= (1 << (index - 32));
shape_hi[5] |= (1u << (index - 32));
index = 8 * (7 - j) + i;
if ( index < 32 )
shape_lo[6] |= (1 << index);
shape_lo[6] |= (1u << index);
else
shape_hi[6] |= (1 << (index - 32));
shape_hi[6] |= (1u << (index - 32));
index = 8 * (7 - j) + (7 - i);
if ( index < 32 )
shape_lo[7] |= (1 << index);
shape_lo[7] |= (1u << index);
else
shape_hi[7] |= (1 << (index - 32));
shape_hi[7] |= (1u << (index - 32));
}

/* Get the corner mask */
Expand Down

0 comments on commit 9a5b789

Please sign in to comment.