[Scummvm-cvs-logs] SF.net SVN: scummvm: [22079] scummvm/trunk/common/util.h

sev at users.sourceforge.net sev at users.sourceforge.net
Fri Apr 21 19:50:01 CEST 2006


Revision: 22079
Author:   sev
Date:     2006-04-21 19:49:27 -0700 (Fri, 21 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22079&view=rev

Log Message:
-----------
Implement CLIP() routine used to put arbitrary value in specified range.

Modified Paths:
--------------
    scummvm/trunk/common/util.h
Modified: scummvm/trunk/common/util.h
===================================================================
--- scummvm/trunk/common/util.h	2006-04-22 02:14:42 UTC (rev 22078)
+++ scummvm/trunk/common/util.h	2006-04-22 02:49:27 UTC (rev 22079)
@@ -37,6 +37,8 @@
 template<typename T> inline T ABS (T x)			{ return (x>=0) ? x : -x; }
 template<typename T> inline T MIN (T a, T b)	{ return (a<b) ? a : b; }
 template<typename T> inline T MAX (T a, T b)	{ return (a>b) ? a : b; }
+template<typename T> inline T CLIP (T v, T amin, T amax) 
+		{ if (v < amin) return amin; else if (v > amax) return amax; else return v; }
 
 /**
  * Template method which swaps the vaulues of its two parameters.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list