From 226ceea12f02e0a5461ea22db297c605d9b63182 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 5 Jun 2022 11:40:04 -0230 Subject: [PATCH] std::min and std::max are templates, and can't be combined with 'using'. --- src/emucore/tia/frame-manager/JitterEmulation.cxx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/emucore/tia/frame-manager/JitterEmulation.cxx b/src/emucore/tia/frame-manager/JitterEmulation.cxx index 682b882e4..05993a114 100644 --- a/src/emucore/tia/frame-manager/JitterEmulation.cxx +++ b/src/emucore/tia/frame-manager/JitterEmulation.cxx @@ -17,8 +17,6 @@ #include using std::abs; -using std::max; -using std::min; using std::pow; using std::round; @@ -90,14 +88,14 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) && abs(myJitter) < static_cast(myRandom.next() % myJitterLines)) { // Repeated invalid frames cause randomly repeated jitter - myJitter = max(min(scanlineDifference, myJitterLines), -myYStart); + myJitter = std::max(std::min(scanlineDifference, myJitterLines), -myYStart); } } if(!vsyncCyclesStable) { // If VSYNC length is too low, the frame rolls permanently down, speed depending on missing cycles - const Int32 jitter = max( - min(round(scanlineCount * (1 - static_cast(vsyncCycles) / myVsyncCycles)), + const Int32 jitter = std::max( + std::min(round(scanlineCount * (1 - static_cast(vsyncCycles) / myVsyncCycles)), myJitterLines), myJitterRecovery + 1); // Roll at least one scanline @@ -114,7 +112,7 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) myJitter += vsyncCycles > myLastFrameVsyncCycles ? myVsyncLines : -myVsyncLines; #endif } - myJitter = max(myJitter, -myYStart); + myJitter = std::max(myJitter, -myYStart); } } else @@ -123,9 +121,9 @@ void JitterEmulation::frameComplete(Int32 scanlineCount, Int32 vsyncCycles) // Only recover during stable frames if(myJitter > 0) - myJitter = max(myJitter - myJitterRecovery, 0); + myJitter = std::max(myJitter - myJitterRecovery, 0); else if(myJitter < 0) - myJitter = min(myJitter + myJitterRecovery, 0); + myJitter = std::min(myJitter + myJitterRecovery, 0); } myLastFrameScanlines = scanlineCount;