summaryrefslogtreecommitdiff
path: root/src/core/math_func.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/math_func.hpp')
-rw-r--r--src/core/math_func.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp
index 0b51d6bbf..570f54c23 100644
--- a/src/core/math_func.hpp
+++ b/src/core/math_func.hpp
@@ -115,7 +115,7 @@ template <typename T>
static inline T *AlignPtr(T *x, uint n)
{
assert_compile(sizeof(size_t) == sizeof(void *));
- return (T *)Align((size_t)x, n);
+ return reinterpret_cast<T *>(Align((size_t)x, n));
}
/**
@@ -202,7 +202,7 @@ static inline uint ClampU(const uint a, const uint min, const uint max)
*/
static inline int32 ClampToI32(const int64 a)
{
- return (int32)Clamp<int64>(a, INT32_MIN, INT32_MAX);
+ return static_cast<int32>(Clamp<int64>(a, INT32_MIN, INT32_MAX));
}
/**
@@ -218,7 +218,7 @@ static inline uint16 ClampToU16(const uint64 a)
* match for min(uint64, uint) than uint64 min(uint64, uint64). As such we
* need to cast the UINT16_MAX to prevent MSVC from displaying its
* infinite loads of warnings. */
- return (uint16)min<uint64>(a, (uint64)UINT16_MAX);
+ return static_cast<uint16>(min<uint64>(a, static_cast<uint64>(UINT16_MAX)));
}
/**
@@ -339,10 +339,10 @@ static inline int RoundDivSU(int a, uint b)
{
if (a > 0) {
/* 0.5 is rounded to 1 */
- return (a + (int)b / 2) / (int)b;
+ return (a + static_cast<int>(b) / 2) / static_cast<int>(b);
} else {
/* -0.5 is rounded to 0 */
- return (a - ((int)b - 1) / 2) / (int)b;
+ return (a - (static_cast<int>(b) - 1) / 2) / static_cast<int>(b);
}
}