]> git.sesse.net Git - stockfish/commitdiff
Better fix for gcc optimization issue
authorMarco Costalba <mcostalba@gmail.com>
Mon, 28 Dec 2009 06:13:12 +0000 (07:13 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Wed, 30 Dec 2009 12:25:02 +0000 (13:25 +0100)
According to the standard, compiler is free to choose
the enum type as long as can keep its data.
Also cast to short and right shift are implementation
defined in case of a signed integer.

Normally all the compilers implement this stuff in
the "usual" way, but gcc with -O3 and -O2 pushes
aggressively the language to its limits to squeeze
even the last bit of speed. And this broke our
not 100% standard conforming code.

The fix is to rewrite the Score enum and the 16 bits
word extracting functions in a way that is 100% standard
compliant and with no speed regression on gcc and also on
the other compilers.

Verified it works on all compilers and with equivalent
functionality.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>

No differences found