diff options
author | bunnei <bunneidev@gmail.com> | 2018-07-25 20:09:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-25 20:09:31 +0200 |
commit | 657bd113e35edc9e36037c8529a1c1027c15c5fd (patch) | |
tree | a8b6bd2227ba84cb4dd3d5a54d0c6d18a3d631d9 /src/core/core_timing.h | |
parent | Merge pull request #802 from lioncash/unreach (diff) | |
parent | core_timing: Split off utility functions into core_timing_util (diff) | |
download | yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.tar yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.tar.gz yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.tar.bz2 yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.tar.lz yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.tar.xz yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.tar.zst yuzu-657bd113e35edc9e36037c8529a1c1027c15c5fd.zip |
Diffstat (limited to 'src/core/core_timing.h')
-rw-r--r-- | src/core/core_timing.h | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index dc31124a8..7fe6380ad 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h @@ -23,59 +23,6 @@ namespace CoreTiming { -// The below clock rate is based on Switch's clockspeed being widely known as 1.020GHz -// The exact value used is of course unverified. -constexpr u64 BASE_CLOCK_RATE = 1019215872; // Switch clock speed is 1020MHz un/docked - -inline s64 msToCycles(int ms) { - // since ms is int there is no way to overflow - return BASE_CLOCK_RATE * static_cast<s64>(ms) / 1000; -} - -inline s64 msToCycles(float ms) { - return static_cast<s64>(BASE_CLOCK_RATE * (0.001f) * ms); -} - -inline s64 msToCycles(double ms) { - return static_cast<s64>(BASE_CLOCK_RATE * (0.001) * ms); -} - -inline s64 usToCycles(float us) { - return static_cast<s64>(BASE_CLOCK_RATE * (0.000001f) * us); -} - -inline s64 usToCycles(int us) { - return (BASE_CLOCK_RATE * static_cast<s64>(us) / 1000000); -} - -s64 usToCycles(s64 us); - -s64 usToCycles(u64 us); - -inline s64 nsToCycles(float ns) { - return static_cast<s64>(BASE_CLOCK_RATE * (0.000000001f) * ns); -} - -inline s64 nsToCycles(int ns) { - return BASE_CLOCK_RATE * static_cast<s64>(ns) / 1000000000; -} - -s64 nsToCycles(s64 ns); - -s64 nsToCycles(u64 ns); - -inline u64 cyclesToNs(s64 cycles) { - return cycles * 1000000000 / BASE_CLOCK_RATE; -} - -inline s64 cyclesToUs(s64 cycles) { - return cycles * 1000000 / BASE_CLOCK_RATE; -} - -inline u64 cyclesToMs(s64 cycles) { - return cycles * 1000 / BASE_CLOCK_RATE; -} - /** * CoreTiming begins at the boundary of timing slice -1. An initial call to Advance() is * required to end slice -1 and start slice 0 before the first cycle of code is executed. |