aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorJeff Ames2008-06-26 02:03:40 +0000
committerJeff Ames2008-06-26 02:03:40 +0000
commit76e24d02ad422987f1bff7c2202e6c9955cfedd8 (patch)
tree5b58435612b0875df2f09717ceefb541445649b1 /OpenSim/Framework/Util.cs
parentAdd patch from bug #1596 - adds Doxygen documentation in OpenSim.Data.MySQL f... (diff)
downloadopensim-SC_OLD-76e24d02ad422987f1bff7c2202e6c9955cfedd8.zip
opensim-SC_OLD-76e24d02ad422987f1bff7c2202e6c9955cfedd8.tar.gz
opensim-SC_OLD-76e24d02ad422987f1bff7c2202e6c9955cfedd8.tar.bz2
opensim-SC_OLD-76e24d02ad422987f1bff7c2202e6c9955cfedd8.tar.xz
Minor refactoring of POS. Adds a Util.Clamp(x, min, max) function.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index a835cec..5b529da 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -130,6 +130,14 @@ namespace OpenSim.Framework
130 return Helpers.UIntsToLong(X, Y); 130 return Helpers.UIntsToLong(X, Y);
131 } 131 }
132 132
133 public static T Clamp<T>(T x, T min, T max)
134 where T : System.IComparable<T>
135 {
136 return x.CompareTo(max) > 0 ? max :
137 x.CompareTo(min) < 0 ? min :
138 x;
139 }
140
133 public static uint GetNextXferID() 141 public static uint GetNextXferID()
134 { 142 {
135 uint id = 0; 143 uint id = 0;