Minor refactoring of POS. Adds a Util.Clamp(x, min, max) function.

This commit is contained in:
Jeff Ames
2008-06-26 02:03:40 +00:00
parent 8a0a0f9bb5
commit 76e24d02ad
2 changed files with 28 additions and 53 deletions

View File

@@ -130,6 +130,14 @@ namespace OpenSim.Framework
return Helpers.UIntsToLong(X, Y);
}
public static T Clamp<T>(T x, T min, T max)
where T : System.IComparable<T>
{
return x.CompareTo(max) > 0 ? max :
x.CompareTo(min) < 0 ? min :
x;
}
public static uint GetNextXferID()
{
uint id = 0;