From 24004372302adfc0e7cb36f8db6830694bf050e9 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 26 Mar 2023 20:18:03 +0100 Subject: clang-tidy: Add `performance-type-promotion-in-math-fn` check https://clang.llvm.org/extra/clang-tidy/checks/performance/type-promotion-in-math-fn.html --- src/.clang-tidy | 1 + src/qt/trafficgraphwidget.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/.clang-tidy b/src/.clang-tidy index b5620b3675..5a5a316953 100644 --- a/src/.clang-tidy +++ b/src/.clang-tidy @@ -10,6 +10,7 @@ performance-for-range-copy, performance-inefficient-vector-operation, performance-move-const-arg, performance-no-automatic-move, +performance-type-promotion-in-math-fn performance-unnecessary-copy-initialization, readability-const-return-type, readability-redundant-declaration, diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp index 08789c1048..fb6f2cb464 100644 --- a/src/qt/trafficgraphwidget.cpp +++ b/src/qt/trafficgraphwidget.cpp @@ -68,8 +68,8 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *) painter.drawLine(XMARGIN, YMARGIN + h, width() - XMARGIN, YMARGIN + h); // decide what order of magnitude we are - int base = floor(log10(fMax)); - float val = pow(10.0f, base); + int base = std::floor(std::log10(fMax)); + float val = std::pow(10.0f, base); const QString units = tr("kB/s"); const float yMarginText = 2.0; -- cgit v1.2.3