Skip to content

Commit e5233a5

Browse files
committed
fix some shift overflows in thordb.c
1 parent 50ae7d4 commit e5233a5

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

thordb.c

+16-16
Original file line numberDiff line numberDiff line change
@@ -2096,44 +2096,44 @@ database_search( int *in_board,
20962096
if ( in_board[pos] != EMPTY ) {
20972097
index = 8 * i + j;
20982098
if ( index < 32 )
2099-
shape_lo[0] |= (1 << index);
2099+
shape_lo[0] |= (1u << index);
21002100
else
2101-
shape_hi[0] |= (1 << (index - 32));
2101+
shape_hi[0] |= (1u << (index - 32));
21022102
index = 8 * i + (7 - j);
21032103
if ( index < 32 )
2104-
shape_lo[1] |= (1 << index);
2104+
shape_lo[1] |= (1u << index);
21052105
else
2106-
shape_hi[1] |= (1 << (index - 32));
2106+
shape_hi[1] |= (1u << (index - 32));
21072107
index = 8 * j + i;
21082108
if ( index < 32 )
2109-
shape_lo[2] |= (1 << index);
2109+
shape_lo[2] |= (1u << index);
21102110
else
2111-
shape_hi[2] |= (1 << (index - 32));
2111+
shape_hi[2] |= (1u << (index - 32));
21122112
index = 8 * j + (7 - i);
21132113
if ( index < 32 )
2114-
shape_lo[3] |= (1 << index);
2114+
shape_lo[3] |= (1u << index);
21152115
else
2116-
shape_hi[3] |= (1 << (index - 32));
2116+
shape_hi[3] |= (1u << (index - 32));
21172117
index = 8 * (7 - i) + j;
21182118
if ( index < 32 )
2119-
shape_lo[4] |= (1 << index);
2119+
shape_lo[4] |= (1u << (index));
21202120
else
2121-
shape_hi[4] |= (1 << (index - 32));
2121+
shape_hi[4] |= (1u << (index - 32));
21222122
index = 8 * (7 - i) + (7 - j);
21232123
if ( index < 32 )
2124-
shape_lo[5] |= (1 << index);
2124+
shape_lo[5] |= (1u << index);
21252125
else
2126-
shape_hi[5] |= (1 << (index - 32));
2126+
shape_hi[5] |= (1u << (index - 32));
21272127
index = 8 * (7 - j) + i;
21282128
if ( index < 32 )
2129-
shape_lo[6] |= (1 << index);
2129+
shape_lo[6] |= (1u << index);
21302130
else
2131-
shape_hi[6] |= (1 << (index - 32));
2131+
shape_hi[6] |= (1u << (index - 32));
21322132
index = 8 * (7 - j) + (7 - i);
21332133
if ( index < 32 )
2134-
shape_lo[7] |= (1 << index);
2134+
shape_lo[7] |= (1u << index);
21352135
else
2136-
shape_hi[7] |= (1 << (index - 32));
2136+
shape_hi[7] |= (1u << (index - 32));
21372137
}
21382138

21392139
/* Get the corner mask */

0 commit comments

Comments
 (0)