diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-02-10 18:33:13 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-18 22:29:19 +0200 |
commit | 1bd706344e2381e11245b2f0bdc291429e46c634 (patch) | |
tree | 4abae5a2088df1eb023967d83c0b808eceb30cea /src/common | |
parent | Common: Correct fcontext fibers. (diff) | |
download | yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.gz yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.bz2 yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.lz yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.xz yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.tar.zst yuzu-1bd706344e2381e11245b2f0bdc291429e46c634.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/fiber.cpp | 21 | ||||
-rw-r--r-- | src/common/fiber.h | 2 | ||||
-rw-r--r-- | src/common/wall_clock.cpp | 12 | ||||
-rw-r--r-- | src/common/wall_clock.h | 4 |
4 files changed, 21 insertions, 18 deletions
diff --git a/src/common/fiber.cpp b/src/common/fiber.cpp index e91d86dbe..a46be73c1 100644 --- a/src/common/fiber.cpp +++ b/src/common/fiber.cpp @@ -12,7 +12,6 @@ namespace Common { - #ifdef _MSC_VER struct Fiber::FiberImpl { @@ -27,14 +26,14 @@ void Fiber::start() { UNREACHABLE(); } -void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) -{ - auto fiber = static_cast<Fiber *>(fiber_parameter); - fiber->start(); +void __stdcall Fiber::FiberStartFunc(void* fiber_parameter) { + auto fiber = static_cast<Fiber*>(fiber_parameter); + fiber->start(); } Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) - : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} { + : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, + previous_fiber{} { impl = std::make_unique<FiberImpl>(); impl->handle = CreateFiber(0, &FiberStartFunc, this); } @@ -99,14 +98,14 @@ void Fiber::start(boost::context::detail::transfer_t& transfer) { UNREACHABLE(); } -void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer) -{ - auto fiber = static_cast<Fiber *>(transfer.data); - fiber->start(transfer); +void Fiber::FiberStartFunc(boost::context::detail::transfer_t transfer) { + auto fiber = static_cast<Fiber*>(transfer.data); + fiber->start(transfer); } Fiber::Fiber(std::function<void(void*)>&& entry_point_func, void* start_parameter) - : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, previous_fiber{} { + : guard{}, entry_point{std::move(entry_point_func)}, start_parameter{start_parameter}, + previous_fiber{} { impl = std::make_unique<FiberImpl>(); impl->context = boost::context::detail::make_fcontext(impl->stack.data(), impl->stack.size(), FiberStartFunc); diff --git a/src/common/fiber.h b/src/common/fiber.h index 89a01fdd8..b530bf4d2 100644 --- a/src/common/fiber.h +++ b/src/common/fiber.h @@ -12,7 +12,7 @@ #ifndef _MSC_VER namespace boost::context::detail { - struct transfer_t; +struct transfer_t; } #endif diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp index 8f5e17fa4..e6161c72c 100644 --- a/src/common/wall_clock.cpp +++ b/src/common/wall_clock.cpp @@ -58,7 +58,8 @@ private: #ifdef ARCHITECTURE_x86_64 -std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency) { +std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, + u32 emulated_clock_frequency) { const auto& caps = GetCPUCaps(); u64 rtsc_frequency = 0; if (caps.invariant_tsc) { @@ -70,15 +71,18 @@ std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u } } if (rtsc_frequency == 0) { - return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency); + return std::make_unique<StandardWallClock>(emulated_cpu_frequency, + emulated_clock_frequency); } else { - return std::make_unique<X64::NativeClock>(emulated_cpu_frequency, emulated_clock_frequency, rtsc_frequency); + return std::make_unique<X64::NativeClock>(emulated_cpu_frequency, emulated_clock_frequency, + rtsc_frequency); } } #else -std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency) { +std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, + u32 emulated_clock_frequency) { return std::make_unique<StandardWallClock>(emulated_cpu_frequency, emulated_clock_frequency); } diff --git a/src/common/wall_clock.h b/src/common/wall_clock.h index fc34429bb..ed284cf50 100644 --- a/src/common/wall_clock.h +++ b/src/common/wall_clock.h @@ -13,7 +13,6 @@ namespace Common { class WallClock { public: - /// Returns current wall time in nanoseconds virtual std::chrono::nanoseconds GetTimeNS() = 0; @@ -46,6 +45,7 @@ private: bool is_native; }; -std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, u32 emulated_clock_frequency); +std::unique_ptr<WallClock> CreateBestMatchingClock(u32 emulated_cpu_frequency, + u32 emulated_clock_frequency); } // namespace Common |