From f5f12fd76d0c4993dd647c42ddf271fd804bdaa3 Mon Sep 17 00:00:00 2001 From: valadaa48 Date: Tue, 15 Dec 2020 22:23:07 -0500 Subject: [PATCH] Small optimization to GPU::SystemTicksToCRTCTicks --- src/core/gpu.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/core/gpu.cpp b/src/core/gpu.cpp index 69af1826c..f88003c51 100644 --- a/src/core/gpu.cpp +++ b/src/core/gpu.cpp @@ -408,20 +408,13 @@ TickCount GPU::CRTCTicksToSystemTicks(TickCount gpu_ticks, TickCount fractional_ TickCount GPU::SystemTicksToCRTCTicks(TickCount sysclk_ticks, TickCount* fractional_ticks) const { - if (!m_console_is_pal) - { - const u64 mul = u64(sysclk_ticks) * u64(715909) + u64(*fractional_ticks); - const TickCount ticks = static_cast(mul / u64(451584)); - *fractional_ticks = static_cast(mul % u64(451584)); - return ticks; - } - else - { - const u64 mul = u64(sysclk_ticks) * u64(709379) + u64(*fractional_ticks); - const TickCount ticks = static_cast(mul / u64(451584)); - *fractional_ticks = static_cast(mul % u64(451584)); - return ticks; - } + u64 mul = u64(sysclk_ticks); + mul *= !m_console_is_pal ? u64(715909) : u64(709379); + mul += u64(*fractional_ticks); + + const TickCount ticks = static_cast(mul / u64(451584)); + *fractional_ticks = static_cast(mul % u64(451584)); + return ticks; } void GPU::AddCommandTicks(TickCount ticks)