From 0503927ec1daa51687e7d22c016570cc3a6f1570 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 5 Jun 2022 11:02:25 -0230 Subject: [PATCH] Fix minor compile warnings in clang. --- .../tia/frame-manager/JitterEmulation.cxx | 32 ++++++++++--------- src/gui/DeveloperDialog.hxx | 1 - 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/emucore/tia/frame-manager/JitterEmulation.cxx b/src/emucore/tia/frame-manager/JitterEmulation.cxx index 905dbe0c9..55c5d23fe 100644 --- a/src/emucore/tia/frame-manager/JitterEmulation.cxx +++ b/src/emucore/tia/frame-manager/JitterEmulation.cxx @@ -15,6 +15,8 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ +#include + #include "JitterEmulation.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -35,24 +37,24 @@ void JitterEmulation::setSensitivity(Int32 sensitivity) myLastFrameScanlines = myLastFrameVsyncCycles = myUnstableCount = myJitter = 0; mySensitivity = BSPF::clamp(sensitivity, MIN_SENSITIVITY, MAX_SENSITIVITY); - const float factor = pow(static_cast(mySensitivity - MIN_SENSITIVITY) / (MAX_SENSITIVITY - MIN_SENSITIVITY), 1.5); + const float factor = std::pow(static_cast(mySensitivity - MIN_SENSITIVITY) / (MAX_SENSITIVITY - MIN_SENSITIVITY), 1.5); - myScanlineDelta = round(MAX_SCANLINE_DELTA - (MAX_SCANLINE_DELTA - MIN_SCANLINE_DELTA) * factor); - myVsyncCycles = round(MIN_VSYNC_CYCLES + (MAX_VSYNC_CYCLES - MIN_VSYNC_CYCLES) * factor); - myVsyncDelta1 = round(MAX_VSYNC_DELTA_1 - (MAX_VSYNC_DELTA_1 - MIN_VSYNC_DELTA_1) * factor); + myScanlineDelta = std::round(MAX_SCANLINE_DELTA - (MAX_SCANLINE_DELTA - MIN_SCANLINE_DELTA) * factor); + myVsyncCycles = std::round(MIN_VSYNC_CYCLES + (MAX_VSYNC_CYCLES - MIN_VSYNC_CYCLES) * factor); + myVsyncDelta1 = std::round(MAX_VSYNC_DELTA_1 - (MAX_VSYNC_DELTA_1 - MIN_VSYNC_DELTA_1) * factor); #ifdef VSYNC_LINE_JITTER - myVsyncDelta2 = round(MIN_VSYNC_DELTA_2 + (MAX_VSYNC_DELTA_2 - MIN_VSYNC_DELTA_2) * factor); + myVsyncDelta2 = std::round(MIN_VSYNC_DELTA_2 + (MAX_VSYNC_DELTA_2 - MIN_VSYNC_DELTA_2) * factor); #endif - myUnstableFrames = round(MAX_UNSTABLE_FRAMES - (MAX_UNSTABLE_FRAMES - MIN_UNSTABLE_FRAMES) * factor); - myJitterLines = round(MIN_JITTER_LINES + (MAX_JITTER_LINES - MIN_JITTER_LINES) * factor); - myVsyncLines = round(MIN_VSYNC_LINES + (MAX_VSYNC_LINES - MIN_VSYNC_LINES) * factor); + myUnstableFrames = std::round(MAX_UNSTABLE_FRAMES - (MAX_UNSTABLE_FRAMES - MIN_UNSTABLE_FRAMES) * factor); + myJitterLines = std::round(MIN_JITTER_LINES + (MAX_JITTER_LINES - MIN_JITTER_LINES) * factor); + myVsyncLines = std::round(MIN_VSYNC_LINES + (MAX_VSYNC_LINES - MIN_VSYNC_LINES) * factor); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) { #ifdef DEBUG_BUILD - const int vsyncLines = round((vsyncCycles - 2) / 76.0); + const int vsyncLines = std::round((vsyncCycles - 2) / 76.0); cerr << "TV jitter " << myJitter << " - " << scanlineCount << ", " << vsyncCycles << ", " << vsyncLines << endl; #endif @@ -61,11 +63,11 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) const bool vsyncCyclesStable = vsyncCycles >= myVsyncCycles; // Handle inconsistency of vsync cycles and around half lines #ifdef VSYNC_LINE_JITTER - const Int32 minLines = round((vsyncCycles - 2 - myVsyncDelta2) / 76.0); - const Int32 maxLines = round((vsyncCycles - 2 + myVsyncDelta2) / 76.0); - const Int32 minLastLines = round((myLastFrameVsyncCycles - 2 - myVsyncDelta2) / 76.0); - const Int32 maxLastLines = round((myLastFrameVsyncCycles - 2 + myVsyncDelta2) / 76.0); - const bool vsyncLinesStable = abs(vsyncCycles - myLastFrameVsyncCycles) < myVsyncDelta1 + const Int32 minLines = std::round((vsyncCycles - 2 - myVsyncDelta2) / 76.0); + const Int32 maxLines = std::round((vsyncCycles - 2 + myVsyncDelta2) / 76.0); + const Int32 minLastLines = std::round((myLastFrameVsyncCycles - 2 - myVsyncDelta2) / 76.0); + const Int32 maxLastLines = std::round((myLastFrameVsyncCycles - 2 + myVsyncDelta2) / 76.0); + const bool vsyncLinesStable = std::abs(vsyncCycles - myLastFrameVsyncCycles) < myVsyncDelta1 && minLines == maxLastLines && maxLines == minLastLines; #else const bool vsyncLinesStable = abs(vsyncCycles - myLastFrameVsyncCycles) < myVsyncDelta1; @@ -90,7 +92,7 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) { // If VSYNC length is too low, the frame rolls permanently down, speed depending on missing cycles const Int32 jitter = std::max( - std::min(round(scanlineCount * (1 - static_cast(vsyncCycles) / myVsyncCycles)), + std::min(std::round(scanlineCount * (1 - static_cast(vsyncCycles) / myVsyncCycles)), myJitterLines), myJitterRecovery + 1); // Roll at least one scanline diff --git a/src/gui/DeveloperDialog.hxx b/src/gui/DeveloperDialog.hxx index 2e900ef9c..eec830596 100644 --- a/src/gui/DeveloperDialog.hxx +++ b/src/gui/DeveloperDialog.hxx @@ -123,7 +123,6 @@ class DeveloperDialog : public Dialog, DevSettingsHandler RadioButtonGroup* mySettingsGroupVideo{nullptr}; CheckboxWidget* myTVJitterWidget{nullptr}; SliderWidget* myTVJitterRecWidget{nullptr}; - StaticTextWidget* myTVJitterRecLabelWidget{nullptr}; SliderWidget* myTVJitterSenseWidget{nullptr}; CheckboxWidget* myColorLossWidget{nullptr}; CheckboxWidget* myDebugColorsWidget{nullptr};