Skip to content

Commit cbe14c4

Browse files
committed
Using Stockfish style casting
1 parent b385c57 commit cbe14c4

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/book/ctg/ctg.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ namespace Polyfish
340340

341341
bool green() const
342342
{
343-
return ((int)recommendation & (int)CtgMoveRecommendation::GreenMove)
343+
return (int(recommendation) & int(CtgMoveRecommendation::GreenMove))
344344
&& annotation != CtgMoveAnnotation::BadMove
345345
&& annotation != CtgMoveAnnotation::LosingMove
346346
&& annotation != CtgMoveAnnotation::InterestingMove
@@ -349,7 +349,7 @@ namespace Polyfish
349349

350350
bool red() const
351351
{
352-
return ((int)recommendation & (int)CtgMoveRecommendation::RedMove);
352+
return (int(recommendation) & int(CtgMoveRecommendation::RedMove));
353353
}
354354
};
355355

@@ -921,10 +921,10 @@ namespace Polyfish
921921
CtgMove& ctgMove = (CtgMove&)stats;
922922

923923
//Recommendations
924-
ctgMove.recommendation = (CtgMoveRecommendation)positionData.positionPage[(uint32_t)positionData.positionPage[0] + 3 + 9 + 4 + 7 + 7];
924+
ctgMove.recommendation = CtgMoveRecommendation(positionData.positionPage[uint32_t(positionData.positionPage[0]) + 3 + 9 + 4 + 7 + 7]);
925925

926926
//Commentary
927-
ctgMove.commentary = (CtgMoveCommentary)positionData.positionPage[(uint32_t)positionData.positionPage[0] + 3 + 9 + 4 + 7 + 7 + 1];
927+
ctgMove.commentary = CtgMoveCommentary(positionData.positionPage[uint32_t(positionData.positionPage[0]) + 3 + 9 + 4 + 7 + 7 + 1]);
928928
}
929929

930930
Move CtgBook::get_pseudo_move(const CtgPositionData& positionData, int moveNum) const

src/book/file_mapping.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ bool FileMapping::map(const std::string& f, bool verbose)
8585
}
8686

8787
//Assign
88-
mapping = (uint64_t)mmap;
88+
mapping = uint64_t(mmap);
8989
baseAddress = viewBase;
9090
dataSize = size_t(li.QuadPart);
9191
#else

src/book/polyglot/polyglot.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ namespace Polyfish
551551
bookMoves.end(),
552552
[&totalWeight](const PolyglotBookMove& x)
553553
{
554-
return (uint64_t)x.entry.count * 200 < totalWeight;
554+
return uint64_t(x.entry.count) * 200 < totalWeight;
555555
}),
556556
bookMoves.end());
557557
#endif

src/misc.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -896,13 +896,13 @@ CommandLine::CommandLine(int _argc, char** _argv) :
896896
if (bytes < KB)
897897
ss << bytes << " B";
898898
else if (bytes < MB)
899-
ss << std::fixed << std::setprecision(decimals) << ((double)bytes / KB) << "KB";
899+
ss << std::fixed << std::setprecision(decimals) << (double(bytes) / KB) << "KB";
900900
else if (bytes < GB)
901-
ss << std::fixed << std::setprecision(decimals) << ((double)bytes / MB) << "MB";
901+
ss << std::fixed << std::setprecision(decimals) << (double(bytes) / MB) << "MB";
902902
else if (bytes < TB)
903-
ss << std::fixed << std::setprecision(decimals) << ((double)bytes / GB) << "GB";
903+
ss << std::fixed << std::setprecision(decimals) << (double(bytes) / GB) << "GB";
904904
else
905-
ss << std::fixed << std::setprecision(decimals) << ((double)bytes / TB) << "TB";
905+
ss << std::fixed << std::setprecision(decimals) << (double(bytes) / TB) << "TB";
906906

907907
return ss.str();
908908
}

0 commit comments

Comments
 (0)