mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Workaround gcc stack alignment bug
GCC uses SSE instructions to move data but in 32-bit gcc version used by abrok the stack is not 16-byte aligned due to a bug. This patch workaround teh bug by not using the stack to store KingFlank[] Fixes issue #721. No functional change.
This commit is contained in:
parent
82d02a3133
commit
f619f1d38c
1 changed files with 14 additions and 13 deletions
|
@ -481,6 +481,19 @@ namespace {
|
|||
// evaluate_threats() assigns bonuses according to the types of the attacking
|
||||
// and the attacked pieces.
|
||||
|
||||
const Bitboard WhiteCamp = Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB;
|
||||
const Bitboard BlackCamp = Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB;
|
||||
const Bitboard QueenSide = FileABB | FileBBB | FileCBB | FileDBB;
|
||||
const Bitboard CenterFiles = FileCBB | FileDBB | FileEBB | FileFBB;
|
||||
const Bitboard KingSide = FileEBB | FileFBB | FileGBB | FileHBB;
|
||||
|
||||
const Bitboard KingFlank[COLOR_NB][FILE_NB] = {
|
||||
{ QueenSide & WhiteCamp, QueenSide & WhiteCamp, QueenSide & WhiteCamp, CenterFiles & WhiteCamp,
|
||||
CenterFiles & WhiteCamp, KingSide & WhiteCamp, KingSide & WhiteCamp, KingSide & WhiteCamp },
|
||||
{ QueenSide & BlackCamp, QueenSide & BlackCamp, QueenSide & BlackCamp, CenterFiles & BlackCamp,
|
||||
CenterFiles & BlackCamp, KingSide & BlackCamp, KingSide & BlackCamp, KingSide & BlackCamp },
|
||||
};
|
||||
|
||||
template<Color Us, bool DoTrace>
|
||||
Score evaluate_threats(const Position& pos, const EvalInfo& ei) {
|
||||
|
||||
|
@ -491,18 +504,6 @@ namespace {
|
|||
const Bitboard TRank2BB = (Us == WHITE ? Rank2BB : Rank7BB);
|
||||
const Bitboard TRank7BB = (Us == WHITE ? Rank7BB : Rank2BB);
|
||||
|
||||
const Bitboard TheirCamp = (Us == WHITE ? Rank4BB | Rank5BB | Rank6BB | Rank7BB | Rank8BB
|
||||
: Rank5BB | Rank4BB | Rank3BB | Rank2BB | Rank1BB);
|
||||
|
||||
const Bitboard QueenSide = TheirCamp & (FileABB | FileBBB | FileCBB | FileDBB);
|
||||
const Bitboard CenterFiles = TheirCamp & (FileCBB | FileDBB | FileEBB | FileFBB);
|
||||
const Bitboard KingSide = TheirCamp & (FileEBB | FileFBB | FileGBB | FileHBB);
|
||||
|
||||
const Bitboard KingFlank[FILE_NB] = {
|
||||
QueenSide, QueenSide, QueenSide, CenterFiles,
|
||||
CenterFiles, KingSide, KingSide, KingSide
|
||||
};
|
||||
|
||||
enum { Minor, Rook };
|
||||
|
||||
Bitboard b, weak, defended, safeThreats;
|
||||
|
@ -571,7 +572,7 @@ namespace {
|
|||
score += ThreatByPawnPush * popcount(b);
|
||||
|
||||
// King tropism: firstly, find squares that we attack in the enemy king flank
|
||||
b = ei.attackedBy[Us][ALL_PIECES] & KingFlank[file_of(pos.square<KING>(Them))];
|
||||
b = ei.attackedBy[Us][ALL_PIECES] & KingFlank[Us][file_of(pos.square<KING>(Them))];
|
||||
|
||||
// Secondly, add to the bitboard the squares which we attack twice in that flank
|
||||
// but which are not protected by a enemy pawn. Note the trick to shift away the
|
||||
|
|
Loading…
Add table
Reference in a new issue