]> git.sesse.net Git - stockfish/commit
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)
commit8d724220a7a19961b21239cba8138815f1d1598f
tree38a7e2961f287878aa9826c610c62e8e1cdd583f
parent0973cc2ef63060294f790803e0525b66ee91dfee
Better fix for gcc optimization issue

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>
src/Makefile
src/value.h