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
value
intThe value to be clamped (要限制的值).
amax
intThe 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
value
uintThe value to be clamped (要限制的值).
amax
uintThe 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
value
longThe value to be clamped (要限制的值).
amax
longThe 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
value
ulongThe value to be clamped (要限制的值).
amax
ulongThe 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
value
ExInt128The value to be clamped (要限制的值).
amax
ExInt128The 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
value
ExUInt128The value to be clamped (要限制的值).
amax
ExUInt128The 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
value
Int128The value to be clamped (要限制的值).
amax
Int128The 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
value
UInt128The value to be clamped (要限制的值).
amax
UInt128The upper bound of the result (结果的上限). It must be a
Pow(2,n)-1
.
Returns
- UInt128
Returns
(value<amax)?( (value>0)?value:0 ):amax
.