diff options
author | rubidium <rubidium@openttd.org> | 2009-12-09 09:28:47 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-12-09 09:28:47 +0000 |
commit | a70f2244e8038205dee10ec7b7bebd1b444bc7c6 (patch) | |
tree | 85ca35ec273979f7d883ff2f18e7cae70893ac8a /src | |
parent | 29f44c099af3297438d8e53a31122784e1afa1f1 (diff) | |
download | openttd-a70f2244e8038205dee10ec7b7bebd1b444bc7c6.tar.xz |
(svn r18443) -Fix (r18438): MSVC thinks, in it's infinite wisdom, that int min(int, int) is a better match for min(uint64, uint) than uint64 min(uint64, uint64). As such we need to cast the UINT16_MAX to prevent MSVC from displaying it's infinite wisdom with loads of warnings.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/math_func.hpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index 576db697d..48690ec58 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -225,7 +225,11 @@ static FORCEINLINE int32 ClampToI32(const int64 a) */ static FORCEINLINE uint16 ClampToU16(const uint64 a) { - return (uint16)min<uint64>(a, UINT16_MAX); + /* MSVC thinks, in it's infinite wisdom, that int min(int, int) is a better + * match for min(uint64, uint) than uint64 min(uint64, uint64). As such we + * need to cast the UINT16_MAX to prevent MSVC from displaying it's + * infinite with loads of warnings. */ + return (uint16)min<uint64>(a, (uint64)UINT16_MAX); } /** |