mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 00:26:33 +08:00
Safe guard some wild and ugly casts
These casts are needed but plain ugly, at least be sure they don't hide any subtle conversion bug. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -89,6 +89,7 @@ void generate_kpk_bitbase(uint8_t bitbase[]) {
|
|||||||
int i, j, b;
|
int i, j, b;
|
||||||
for(i = 0; i < 24576; i++) {
|
for(i = 0; i < 24576; i++) {
|
||||||
for(b = 0, j = 0; j < 8; b |= (compress_result(Bitbase[8*i+j]) << j), j++);
|
for(b = 0, j = 0; j < 8; b |= (compress_result(Bitbase[8*i+j]) << j), j++);
|
||||||
|
assert(b == int(uint8_t(b)));
|
||||||
bitbase[i] = (uint8_t)b;
|
bitbase[i] = (uint8_t)b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -490,7 +490,10 @@ void init_eval(int threads) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Bitboard b = 0ULL; b < 256ULL; b++)
|
for (Bitboard b = 0ULL; b < 256ULL; b++)
|
||||||
|
{
|
||||||
|
assert(count_1s(b) == int(uint8_t(count_1s(b))));
|
||||||
BitCount8Bit[b] = (uint8_t)count_1s(b);
|
BitCount8Bit[b] = (uint8_t)count_1s(b);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user