Use the standard library swap() function instead

This commit is contained in:
Daniel Chappuis 2014-09-19 22:53:05 +02:00
parent a89b258418
commit ebf13c3366
2 changed files with 2 additions and 9 deletions

View File

@ -90,7 +90,7 @@ bool BoxShape::raycast(const Ray& ray, ProxyShape* proxyShape) const {
// Swap t1 and t2 if need so that t1 is intersection with near plane and
// t2 with far plane
if (t1 > t2) swap(t1, t2);
if (t1 > t2) std::swap(t1, t2);
// If t1 is negative, the origin is inside the box and therefore, there is no hit
if (t1 < decimal(0.0)) return false;
@ -141,7 +141,7 @@ bool BoxShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, ProxyShape* pro
// Swap t1 and t2 if need so that t1 is intersection with near plane and
// t2 with far plane
if (t1 > t2) {
swap(t1, t2);
std::swap(t1, t2);
currentNormal = -currentNormal;
}

View File

@ -51,13 +51,6 @@ inline decimal clamp(decimal value, decimal lowerLimit, decimal upperLimit) {
return std::min(std::max(value, lowerLimit), upperLimit);
}
/// Function that swaps two values
inline void swap(decimal& a, decimal& b) {
decimal temp = a;
a = b;
b = temp;
}
}