summaryrefslogtreecommitdiffstats
path: root/src/Globals.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Globals.h')
-rw-r--r--src/Globals.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Globals.h b/src/Globals.h
index 1e90d83e9..7ee045130 100644
--- a/src/Globals.h
+++ b/src/Globals.h
@@ -235,6 +235,16 @@ public:
+/** Clamp a_X to the specified range. */
+template <typename T>
+T Clamp(T a_X, T a_Min, T a_Max)
+{
+ return std::min(std::max(a_X, a_Min), a_Max);
+}
+
+
+
+
// Common headers (part 2, with macros):
#include "ChunkDef.h"