Table of Contents

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 int

The value to be clamped (要限制的值).

amax int

The 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 uint

The value to be clamped (要限制的值).

amax uint

The 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 long

The value to be clamped (要限制的值).

amax long

The 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 ulong

The value to be clamped (要限制的值).

amax ulong

The 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 ExInt128

The value to be clamped (要限制的值).

amax ExInt128

The 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 ExUInt128

The value to be clamped (要限制的值).

amax ExUInt128

The 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 Int128

The value to be clamped (要限制的值).

amax Int128

The 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 UInt128

The value to be clamped (要限制的值).

amax UInt128

The upper bound of the result (结果的上限). It must be a Pow(2,n)-1.

Returns

UInt128

Returns (value<amax)?( (value>0)?value:0 ):amax.