summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2020-02-09 00:39:30 +0000
committerGitHub <noreply@github.com>2020-02-09 00:39:30 +0000
commit0043a2cf3c86ce2b47203fce643b2e3faedab708 (patch)
tree6ddd6969f805fc21e72c8890113291014566b021
parent6a857df219f32a6b29683f54100e4cd92edd18e3 (diff)
parent4f47cccd9f46ca848f7a2923d3429d2b1dc21265 (diff)
Merge pull request #8615 from jordan-woyak/std-abs
Cleanup: Use std::abs instead of abs.
-rw-r--r--Source/Core/Common/MathUtil.h4
-rw-r--r--Source/Core/Core/HW/SystemTimers.cpp4
-rw-r--r--Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/Source/Core/Common/MathUtil.h b/Source/Core/Common/MathUtil.h
index c8489a389a..3ad01bc9fe 100644
--- a/Source/Core/Common/MathUtil.h
+++ b/Source/Core/Common/MathUtil.h
@@ -70,8 +70,8 @@ struct Rectangle
return left == r.left && top == r.top && right == r.right && bottom == r.bottom;
}
- T GetWidth() const { return abs(right - left); }
- T GetHeight() const { return abs(bottom - top); }
+ T GetWidth() const { return std::abs(right - left); }
+ T GetHeight() const { return std::abs(bottom - top); }
// If the rectangle is in a coordinate system with a lower-left origin, use
// this Clamp.
void ClampLL(T x1, T y1, T x2, T y2)
diff --git a/Source/Core/Core/HW/SystemTimers.cpp b/Source/Core/Core/HW/SystemTimers.cpp
index 3a0b3192a8..987f102c3b 100644
--- a/Source/Core/Core/HW/SystemTimers.cpp
+++ b/Source/Core/Core/HW/SystemTimers.cpp
@@ -191,10 +191,10 @@ void ThrottleCallback(u64 last_time, s64 cyclesLate)
if (config.m_EmulationSpeed != 1.0f)
next_event = u32(next_event * config.m_EmulationSpeed);
const s64 max_fallback = config.iTimingVariance * 1000;
- if (abs(diff) > max_fallback)
+ if (std::abs(diff) > max_fallback)
{
DEBUG_LOG(COMMON, "system too %s, %" PRIi64 " ms skipped", diff < 0 ? "slow" : "fast",
- abs(diff) - max_fallback);
+ std::abs(diff) - max_fallback);
last_time = time - max_fallback;
}
else if (diff > 1000)
diff --git a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
index ff27eedf44..633950cc2d 100644
--- a/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
+++ b/Source/Core/InputCommon/ControllerInterface/DInput/DInputJoystick.cpp
@@ -310,6 +310,6 @@ ControlState Joystick::Hat::GetState() const
if (is_centered)
return 0;
- return (abs((int)(m_hat / 4500 - m_direction * 2 + 8) % 8 - 4) > 2);
+ return (std::abs(int(m_hat / 4500 - m_direction * 2 + 8) % 8 - 4) > 2);
}
} // namespace ciface::DInput