position: 简化 update_key_misc() 代码

This commit is contained in:
Calcitem 2020-10-01 16:58:58 +08:00
parent 6e22421d8e
commit b020ec56ff
1 changed files with 1 additions and 4 deletions

View File

@ -1257,11 +1257,8 @@ Key Position::update_key_misc()
const int KEY_MISC_BIT = 2;
st->key = st->key << KEY_MISC_BIT >> KEY_MISC_BIT;
Key hi = 0;
hi |= static_cast<Key>(pieceCountNeedRemove);
st->key = st->key | (hi << (CHAR_BIT * sizeof(Key) - KEY_MISC_BIT));
st->key |= static_cast<Key>(pieceCountNeedRemove) << (CHAR_BIT * sizeof(Key) - KEY_MISC_BIT);
return st->key;
}