From: Marco Costalba Date: Mon, 28 Dec 2009 06:13:12 +0000 (+0100) Subject: Better fix for gcc optimization issue X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=8d724220a7a19961b21239cba8138815f1d1598f;hp=8d724220a7a19961b21239cba8138815f1d1598f 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 ---