mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-13 02:52:37 +00:00
Codechange: hint in all branches of ClampTo to resolve compile-time (#11130)
This commit is contained in:
parent
97138acc8a
commit
ab19882e94
@ -168,12 +168,12 @@ constexpr To ClampTo(From value)
|
||||
static_assert(std::numeric_limits<To>::is_integer, "Do not clamp from non-integer values");
|
||||
static_assert(std::numeric_limits<From>::is_integer, "Do not clamp to non-integer values");
|
||||
|
||||
if (sizeof(To) >= sizeof(From) && std::numeric_limits<To>::is_signed == std::numeric_limits<From>::is_signed) {
|
||||
if constexpr (sizeof(To) >= sizeof(From) && std::numeric_limits<To>::is_signed == std::numeric_limits<From>::is_signed) {
|
||||
/* Same signedness and To type is larger or equal than From type, no clamping is required. */
|
||||
return static_cast<To>(value);
|
||||
}
|
||||
|
||||
if (sizeof(To) > sizeof(From) && std::numeric_limits<To>::is_signed) {
|
||||
if constexpr (sizeof(To) > sizeof(From) && std::numeric_limits<To>::is_signed) {
|
||||
/* Signed destination and a larger To type, no clamping is required. */
|
||||
return static_cast<To>(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user