From: Marco Costalba Date: Sat, 7 Dec 2013 10:33:31 +0000 (+0100) Subject: More readable init of MS1BTable[] X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=1ff5ce8863cb71f42dc0f707dd566e566c658eb5;ds=sidebyside More readable init of MS1BTable[] Because now it uses lsb(), the BSFTable[] must be already initialized. No functional change. --- diff --git a/src/bitboard.cpp b/src/bitboard.cpp index 3597e7d8..fd3db671 100644 --- a/src/bitboard.cpp +++ b/src/bitboard.cpp @@ -151,13 +151,12 @@ const std::string Bitboards::pretty(Bitboard b) { void Bitboards::init() { - for (int k = 0, i = 0; i < 8; ++i) - while (k < (2 << i)) - MS1BTable[k++] = i; - for (Square s = SQ_A1; s <= SQ_H8; ++s) BSFTable[bsf_index(SquareBB[s] = 1ULL << s)] = s; + for (Bitboard b = 1; b < 256; ++b) + MS1BTable[b] = more_than_one(b) ? MS1BTable[b - 1] : lsb(b); + FileBB[FILE_A] = FileABB; RankBB[RANK_1] = Rank1BB;