From 151b0e63338a8f8645f908e48fb7423795224690 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 28 Aug 2015 15:29:17 -1000 Subject: [PATCH] made clamp a template function --- include/Math.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/Math.hpp b/include/Math.hpp index 2490058..41dbdd5 100644 --- a/include/Math.hpp +++ b/include/Math.hpp @@ -16,8 +16,8 @@ namespace Math { - inline void clamp(float& val, float min, float max) {val = MAX(min, MIN(max, val));} - inline void clamp(int& val, int min, int max) {val = MAX(min, MIN(max, val));} + template + inline T clamp(T min, T val, T max) {return MAX(min, MIN(max, val));} inline float radToDeg(float rad) {return rad * 180.f / M_PI;} inline float degToRad(float deg) {return deg * M_PI / 180;}