Mercurial > hg > openttd
changeset 13912:3be57eaa986d draft
(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.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 09 Dec 2009 09:28:47 +0000 |
parents | a988b35a9705 |
children | 9ae8a0686e06 |
files | src/core/math_func.hpp |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -225,7 +225,11 @@ */ 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); } /**