From: Marco Costalba Date: Fri, 14 Feb 2014 09:43:37 +0000 (+0100) Subject: Fix magic boosters conversion X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=b3470d7ab1d8cfe0bacffc42fc9b30347940b5f4;hp=e4695f15bc62c0e34572b3a995e25b7461d2ae90 Fix magic boosters conversion Fix small overflow error while converting magic boosters from right rotate to left rotate, in particular booster 38 was converted to 4122 instead of the corrcet value 26. Formula used was: s1 = original & 63, s2 = (original >> 6) & 63; new = (64 - s1) | ((64 - s2) << 6); Instead of: s1 = original & 63, s2 = (original >> 6) & 63; new = ((64 - s1) & 63) | (((64 - s2) & 63) << 6); This has no impact in number of cycles needed, but just in the resultig number that yields to a rotate amount bigger than 63. Spotted by Ehsan Rashid. No functional change. --- diff --git a/src/bitboard.cpp b/src/bitboard.cpp index b7eed922..3df7d425 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -255,7 +255,7 @@ namespace { Bitboard masks[], unsigned shifts[], Square deltas[], Fn index) { int MagicBoosters[][8] = { { 969, 1976, 2850, 542, 2069, 2852, 1708, 164 }, - { 3101, 552, 3555, 926, 834, 4122, 2131, 1117 } }; + { 3101, 552, 3555, 926, 834, 26, 2131, 1117 } }; RKISS rk; Bitboard occupancy[4096], reference[4096], edges, b;