diff options
| author | 2019-05-25 17:01:16 -0400 | |
|---|---|---|
| committer | 2019-05-25 17:01:18 -0400 | |
| commit | 0fa039d8d0d61bc12365684b9924ff78eda75f8a (patch) | |
| tree | 25803b5d01d3639f3f77a1658dac7e9b503c6641 | |
| parent | loader/nso: Silence sign-comparison warning (diff) | |
| download | yuzu-0fa039d8d0d61bc12365684b9924ff78eda75f8a.tar.gz yuzu-0fa039d8d0d61bc12365684b9924ff78eda75f8a.tar.xz yuzu-0fa039d8d0d61bc12365684b9924ff78eda75f8a.zip | |
core_timing_util: Silence sign-comparison warnings
We can just make the conversion explicit instead of implicit here to
silence -Wsign-compare warnings.
| -rw-r--r-- | src/core/core_timing_util.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/core_timing_util.cpp b/src/core/core_timing_util.cpp index 7942f30d6..c0f08cddb 100644 --- a/src/core/core_timing_util.cpp +++ b/src/core/core_timing_util.cpp | |||
| @@ -14,11 +14,11 @@ namespace Core::Timing { | |||
| 14 | constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE; | 14 | constexpr u64 MAX_VALUE_TO_MULTIPLY = std::numeric_limits<s64>::max() / BASE_CLOCK_RATE; |
| 15 | 15 | ||
| 16 | s64 usToCycles(s64 us) { | 16 | s64 usToCycles(s64 us) { |
| 17 | if (us / 1000000 > MAX_VALUE_TO_MULTIPLY) { | 17 | if (static_cast<u64>(us / 1000000) > MAX_VALUE_TO_MULTIPLY) { |
| 18 | LOG_ERROR(Core_Timing, "Integer overflow, use max value"); | 18 | LOG_ERROR(Core_Timing, "Integer overflow, use max value"); |
| 19 | return std::numeric_limits<s64>::max(); | 19 | return std::numeric_limits<s64>::max(); |
| 20 | } | 20 | } |
| 21 | if (us > MAX_VALUE_TO_MULTIPLY) { | 21 | if (static_cast<u64>(us) > MAX_VALUE_TO_MULTIPLY) { |
| 22 | LOG_DEBUG(Core_Timing, "Time very big, do rounding"); | 22 | LOG_DEBUG(Core_Timing, "Time very big, do rounding"); |
| 23 | return BASE_CLOCK_RATE * (us / 1000000); | 23 | return BASE_CLOCK_RATE * (us / 1000000); |
| 24 | } | 24 | } |
| @@ -38,11 +38,11 @@ s64 usToCycles(u64 us) { | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | s64 nsToCycles(s64 ns) { | 40 | s64 nsToCycles(s64 ns) { |
| 41 | if (ns / 1000000000 > MAX_VALUE_TO_MULTIPLY) { | 41 | if (static_cast<u64>(ns / 1000000000) > MAX_VALUE_TO_MULTIPLY) { |
| 42 | LOG_ERROR(Core_Timing, "Integer overflow, use max value"); | 42 | LOG_ERROR(Core_Timing, "Integer overflow, use max value"); |
| 43 | return std::numeric_limits<s64>::max(); | 43 | return std::numeric_limits<s64>::max(); |
| 44 | } | 44 | } |
| 45 | if (ns > MAX_VALUE_TO_MULTIPLY) { | 45 | if (static_cast<u64>(ns) > MAX_VALUE_TO_MULTIPLY) { |
| 46 | LOG_DEBUG(Core_Timing, "Time very big, do rounding"); | 46 | LOG_DEBUG(Core_Timing, "Time very big, do rounding"); |
| 47 | return BASE_CLOCK_RATE * (ns / 1000000000); | 47 | return BASE_CLOCK_RATE * (ns / 1000000000); |
| 48 | } | 48 | } |