summaryrefslogtreecommitdiff
path: root/src/core/math_func.hpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-04-04 20:34:09 +0000
committersmatz <smatz@openttd.org>2008-04-04 20:34:09 +0000
commitfb379b522d90274def9fc1077577cd2a601a60b5 (patch)
treebd5fa43242be00f91b2f36e2395049d516520dfd /src/core/math_func.hpp
parenta7d885e4c60b044dc9e57ec1ec6a3e3b514d4b2f (diff)
downloadopenttd-fb379b522d90274def9fc1077577cd2a601a60b5.tar.xz
(svn r12573) -Codechange: use defined constants instead of numbers in math_func.hpp
Diffstat (limited to 'src/core/math_func.hpp')
-rw-r--r--src/core/math_func.hpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp
index 63f21fd28..35aeeee1e 100644
--- a/src/core/math_func.hpp
+++ b/src/core/math_func.hpp
@@ -163,8 +163,8 @@ static inline uint ClampU(const uint a, const uint min, const uint max)
*/
static inline int32 ClampToI32(const int64 a)
{
- if (a <= (int32)0x80000000) return 0x80000000;
- if (a >= (int32)0x7FFFFFFF) return 0x7FFFFFFF;
+ if (a <= INT32_MIN) return INT32_MIN;
+ if (a >= INT32_MAX) return INT32_MAX;
return (int32)a;
}
@@ -177,7 +177,7 @@ static inline int32 ClampToI32(const int64 a)
*/
static inline uint16 ClampToU16(const uint64 a)
{
- return (uint16)(a <= 0xFFFFU ? a : 0xFFFFU);
+ return (uint16)(a <= UINT16_MAX ? a : UINT16_MAX);
}
/**