diff options
author | Lioncash <mathew1800@gmail.com> | 2020-10-15 20:49:45 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-10-18 01:50:39 +0200 |
commit | be1954e04cb5a0c3a526f78ed5490a5e65310280 (patch) | |
tree | 267db7ae4be88dbbc288fa605e35d4a2a13839f6 /src/core/core_timing.cpp | |
parent | Merge pull request #4787 from lioncash/conversion (diff) | |
download | yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.gz yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.bz2 yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.lz yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.xz yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.tar.zst yuzu-be1954e04cb5a0c3a526f78ed5490a5e65310280.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/core_timing.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index e6c8461a5..9b01f6293 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -140,7 +140,8 @@ void CoreTiming::AddTicks(u64 ticks) { void CoreTiming::Idle() { if (!event_queue.empty()) { const u64 next_event_time = event_queue.front().time; - const u64 next_ticks = nsToCycles(std::chrono::nanoseconds(next_event_time)) + 10U; + const u64 next_ticks = + static_cast<u64>(nsToCycles(std::chrono::nanoseconds(next_event_time))) + 10; if (next_ticks > ticks) { ticks = next_ticks; } @@ -187,7 +188,7 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) { std::optional<s64> CoreTiming::Advance() { std::scoped_lock lock{advance_lock, basic_lock}; - global_timer = GetGlobalTimeNs().count(); + global_timer = static_cast<u64>(GetGlobalTimeNs().count()); while (!event_queue.empty() && event_queue.front().time <= global_timer) { Event evt = std::move(event_queue.front()); @@ -201,11 +202,11 @@ std::optional<s64> CoreTiming::Advance() { } basic_lock.lock(); - global_timer = GetGlobalTimeNs().count(); + global_timer = static_cast<u64>(GetGlobalTimeNs().count()); } if (!event_queue.empty()) { - const s64 next_time = event_queue.front().time - global_timer; + const auto next_time = static_cast<s64>(event_queue.front().time - global_timer); return next_time; } else { return std::nullopt; @@ -240,14 +241,14 @@ std::chrono::nanoseconds CoreTiming::GetGlobalTimeNs() const { if (is_multicore) { return clock->GetTimeNS(); } - return CyclesToNs(ticks); + return CyclesToNs(static_cast<s64>(ticks)); } std::chrono::microseconds CoreTiming::GetGlobalTimeUs() const { if (is_multicore) { return clock->GetTimeUS(); } - return CyclesToUs(ticks); + return CyclesToUs(static_cast<s64>(ticks)); } } // namespace Core::Timing |