diff options
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 8 |
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; |