[Gridflow-cvs] [svn] commit: r3799 - /trunk/gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Wed Jun 4 16:52:28 EDT 2008


Author: matju
Date: Wed Jun  4 16:52:27 2008
New Revision: 3799

Log:
add clip function (like #clip but as an ordinary C++ function template)

Modified:
    trunk/gridflow.h

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Wed Jun  4 16:52:27 2008
@@ -93,6 +93,7 @@
 // minimum/maximum functions; T is assumed to be Comparable
 template <class T> static inline T min(T a, T b) {return a<b?a:b;}
 template <class T> static inline T max(T a, T b) {return a>b?a:b;}
+template <class T> static inline T clip(T a, T lower, T upper) {return a<lower?lower:a>upper?upper:a;}
 //template <class T> inline T min(T a, T b) { T c = (a-b)>>31; return (a&c)|(b&~c); }
 
 // greatest common divisor, by euclid's algorithm



More information about the Gridflow-cvs mailing list