From 27eb5a5628316ab8d61216f5467a52da7b40a08f Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 20 Nov 2021 23:40:26 +0800 Subject: [PATCH] cpp: Fix C++20 warnings --- src/position.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/position.cpp b/src/position.cpp index 4063b7ec..7d18716e 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -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& 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(f * RANK_NB + r); } @@ -1548,8 +1548,8 @@ void Position::turn(vector& 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(f * RANK_NB + r); }