mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-19 08:36:33 +08:00
Fix DIVIDE BY ZERO exception in init_search()
It happens that when d == 0 we calculate: log(double(0 * 0) / 2) Unfortunately, log(0) is "illegal" and can generate either a floating point exception or return a nonsense "huge" value depending on the platform. This fixs in the proper way the GCC/ICC rounding difference, bug was from our side, not in the intel compiler. Also fixed some few other warnings. Bug spotted by Richard Lloyd. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -182,7 +182,7 @@ Phase MaterialInfoTable::game_phase(const Position& pos) {
|
||||
MaterialInfo* MaterialInfoTable::get_material_info(const Position& pos) {
|
||||
|
||||
Key key = pos.get_material_key();
|
||||
int index = key & (size - 1);
|
||||
unsigned index = unsigned(key & (size - 1));
|
||||
MaterialInfo* mi = entries + index;
|
||||
|
||||
// If mi->key matches the position's material hash key, it means that we
|
||||
|
||||
Reference in New Issue
Block a user