cpp: Fix C++20 warnings

This commit is contained in:
Calcitem 2021-11-20 23:40:26 +08:00
parent e43d30d9b9
commit 27eb5a5628
1 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
// This file is part of Sanmill.
// This file is part of Sanmill.
// Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
//
// Sanmill is free software: you can redistribute it and/or modify
@ -1447,8 +1447,8 @@ void Position::mirror(vector<string>& moveHistory, bool cmdChange /*= true*/)
}
if (currentSquare != 0) {
f = currentSquare / RANK_NB;
r = currentSquare % RANK_NB;
f = currentSquare / (Square)RANK_NB;
r = currentSquare % (Square)RANK_NB;
r = (RANK_NB - r) % RANK_NB;
currentSquare = static_cast<Square>(f * RANK_NB + r);
}
@ -1548,8 +1548,8 @@ void Position::turn(vector<string>& moveHistory, bool cmdChange /*= true*/)
}
if (currentSquare != 0) {
f = currentSquare / RANK_NB;
r = currentSquare % RANK_NB;
f = currentSquare / (Square)RANK_NB;
r = currentSquare % (Square)RANK_NB;
if (f == 1)
f = FILE_NB;
@ -1716,8 +1716,8 @@ void Position::rotate(
}
if (currentSquare != 0) {
f = currentSquare / RANK_NB;
r = currentSquare % RANK_NB;
f = currentSquare / (Square)RANK_NB;
r = currentSquare % (Square)RANK_NB;
r = (r + RANK_NB - degrees) % RANK_NB;
currentSquare = static_cast<Square>(f * RANK_NB + r);
}