mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-11-23 19:30:59 +00:00
9fca4b220f
--HG-- extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4047214
21 lines
529 B
C#
21 lines
529 B
C#
namespace Jellyfish.Library
|
|
{
|
|
public static class MathHelpers
|
|
{
|
|
public static int Clamp(int value, int min, int max)
|
|
{
|
|
return (value < min) ? min : (value > max) ? max : value;
|
|
}
|
|
|
|
public static double Clamp(double value, double min, double max)
|
|
{
|
|
return (value < min) ? min : (value > max) ? max : value;
|
|
}
|
|
|
|
public static int ClampByte(int value)
|
|
{
|
|
return Clamp(value, byte.MinValue, byte.MaxValue);
|
|
}
|
|
}
|
|
}
|