(svn r12192) -Fix: clamp various town variables to 16bit prior to returning the value

This commit is contained in:
smatz
2008-02-20 14:30:53 +00:00
parent 0e9e94a94b
commit ca46154068
2 changed files with 31 additions and 18 deletions

View File

@@ -168,6 +168,18 @@ static inline int32 ClampToI32(const int64 a)
return (int32)a;
}
/**
* Reduce an usigned 64-bit int to an unsigned 16-bit one
*
* @param a The 64-bit value to clamp
* @return The 64-bit value reduced to a 16-bit value
* @see ClampU(uint, uint, uint)
*/
static inline uint16 ClampToU16(const uint64 a)
{
return min(a, UINT16_MAX);
}
/**
* Returns the (absolute) difference between two (scalar) variables
*