1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Score enum should be at least 32 bits

The compiler is allowed to chose the size of an enum variable
based on the values it is expected to store. So force the compiler
to use at least a 32 bit integer type for the Score.

MSVC and Intel do not change, while gcc under -O3 is affected
by this change.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2009-12-27 19:45:19 +01:00
parent 3f14f9a478
commit 0973cc2ef6

View file

@ -56,7 +56,7 @@ enum Value {
/// integer (enum), first LSB 16 bits are used to store endgame /// integer (enum), first LSB 16 bits are used to store endgame
/// value, while upper bits are used for midgame value. /// value, while upper bits are used for midgame value.
enum Score {}; enum Score { ENSURE_32_BIT_SIZE = 1 << 31 };
inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); } inline Value eg_value(Score s) { return Value(int16_t(s & 0xffff)); }
inline Value mg_value(Score s) { return Value((int(s) + 32768) >> 16); } inline Value mg_value(Score s) { return Value((int(s) + 32768) >> 16); }