diff options
Diffstat (limited to '')
-rw-r--r-- | src/Globals.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Globals.h b/src/Globals.h index 1e90d83e9..e4737a98a 100644 --- a/src/Globals.h +++ b/src/Globals.h @@ -235,6 +235,16 @@ public: +/** Clamp X to the specified range. */ +template <typename T> +T Clamp(T a_Value, T a_Min, T a_Max) +{ + return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value); +} + + + + // Common headers (part 2, with macros): #include "ChunkDef.h" |