Method ClampToBitMax
- Namespace
- Zyl.VectorTraits.Numerics
- Assembly
- VectorTraits.dll
ClampToBitMax(int, int)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
public static int ClampToBitMax(int value, int amax)
Parameters
valueintThe value to be clamped (要限制的值).
amaxintThe upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- int
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(uint, uint)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
[CLSCompliant(false)]
public static uint ClampToBitMax(uint value, uint amax)
Parameters
valueuintThe value to be clamped (要限制的值).
amaxuintThe upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- uint
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(long, long)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
public static long ClampToBitMax(long value, long amax)
Parameters
valuelongThe value to be clamped (要限制的值).
amaxlongThe upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- long
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(ulong, ulong)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
[CLSCompliant(false)]
public static ulong ClampToBitMax(ulong value, ulong amax)
Parameters
valueulongThe value to be clamped (要限制的值).
amaxulongThe upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- ulong
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(ExInt128, ExInt128)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
public static ExInt128 ClampToBitMax(ExInt128 value, ExInt128 amax)
Parameters
valueExInt128The value to be clamped (要限制的值).
amaxExInt128The upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- ExInt128
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(ExUInt128, ExUInt128)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
[CLSCompliant(false)]
public static ExUInt128 ClampToBitMax(ExUInt128 value, ExUInt128 amax)
Parameters
valueExUInt128The value to be clamped (要限制的值).
amaxExUInt128The upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- ExUInt128
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(Int128, Int128)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
public static Int128 ClampToBitMax(Int128 value, Int128 amax)
Parameters
valueInt128The value to be clamped (要限制的值).
amaxInt128The upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- Int128
Returns
(value<amax)?( (value>0)?value:0 ):amax.
ClampToBitMax(UInt128, UInt128)
Returns value clamped to the inclusive range of 0 and amax (返回限制在 0 和 amax 范围内的 value). amax must be a Pow(2,n)-1.
[CLSCompliant(false)]
public static UInt128 ClampToBitMax(UInt128 value, UInt128 amax)
Parameters
valueUInt128The value to be clamped (要限制的值).
amaxUInt128The upper bound of the result (结果的上限). It must be a
Pow(2,n)-1.
Returns
- UInt128
Returns
(value<amax)?( (value>0)?value:0 ):amax.