summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/lldefs.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h
index a567fd7c12..5c46f6a796 100644
--- a/indra/llcommon/lldefs.h
+++ b/indra/llcommon/lldefs.h
@@ -214,13 +214,14 @@ inline auto llmin(T1 d1, T2 d2, T3 d3, T4 d4)
template <typename A, typename MIN, typename MAX>
inline A llclamp(A a, MIN minval, MAX maxval)
{
- if ( a < minval )
+ A aminval{ static_cast<A>(minval) }, amaxval{ static_cast<A>(maxval) };
+ if ( a < aminval )
{
- return static_cast<A>(minval);
+ return aminval;
}
- else if ( a > maxval )
+ else if ( a > amaxval )
{
- return static_cast<A>(maxval);
+ return amaxval;
}
return a;
}