Quantum 3 3.1.0

Static Public Member Functions | List of all members
System.Numerics.BitOperations Class Reference

Fallback implementations for Unity builds that cannot use the .NET versions. More...

Static Public Member Functions

static bool IsPow2 (UInt32 value)
 Evaluate whether a given integral value is a power of 2. More...
 
static bool IsPow2 (UInt64 value)
 Evaluate whether a given integral value is a power of 2. More...
 
static bool IsPow2 (UIntPtr value)
 Evaluate whether a given integral value is a power of 2. More...
 
static Int32 LeadingZeroCount (UInt32 value)
 Count the number of leading zero bits in a mask. Similar in behavior to the x86 instruction LZCNT. More...
 
static Int32 LeadingZeroCount (UInt64 value)
 Count the number of leading zero bits in a mask. Similar in behavior to the x86 instruction LZCNT. More...
 
static Int32 Log2 (UInt32 value)
 Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined. More...
 
static Int32 Log2 (UInt64 value)
 Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined. More...
 
static Int32 Log2 (UIntPtr value)
 Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined. More...
 
static Int32 PopCount (UInt32 value)
 Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT. More...
 
static Int32 PopCount (UInt64 value)
 Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT. More...
 
static Int32 PopCount (UIntPtr value)
 Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT. More...
 
static UInt32 RotateLeft (UInt32 value, Int32 offset)
 Rotates the specified value left by the specified number of bits. Similar in behavior to the x86 instruction ROL. More...
 
static UInt64 RotateLeft (UInt64 value, Int32 offset)
 Rotates the specified value left by the specified number of bits. Similar in behavior to the x86 instruction ROL. More...
 
static UIntPtr RotateLeft (UIntPtr value, Int32 offset)
 Rotates the specified value left by the specified number of bits. Similar in behavior to the x86 instruction ROL. More...
 
static UInt32 RotateRight (UInt32 value, Int32 offset)
 Rotates the specified value right by the specified number of bits. Similar in behavior to the x86 instruction ROR. More...
 
static UInt64 RotateRight (UInt64 value, Int32 offset)
 Rotates the specified value right by the specified number of bits. Similar in behavior to the x86 instruction ROR. More...
 
static UIntPtr RotateRight (UIntPtr value, Int32 offset)
 Rotates the specified value right by the specified number of bits. Similar in behavior to the x86 instruction ROR. More...
 
static UInt32 RoundUpToPowerOf2 (UInt32 value)
 Round the given integral value up to a power of 2. More...
 
static UInt64 RoundUpToPowerOf2 (UInt64 value)
 Round the given integral value up to a power of 2. More...
 
static UIntPtr RoundUpToPowerOf2 (UIntPtr value)
 Round the given integral value up to a power of 2. More...
 
static Int32 TrailingZeroCount (Int32 value)
 Count the number of trailing zero bits in an integer value. Similar in behavior to the x86 instruction TZCNT. More...
 
static Int32 TrailingZeroCount (Int64 value)
 Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT. More...
 
static Int32 TrailingZeroCount (IntPtr value)
 Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT. More...
 
static Int32 TrailingZeroCount (UInt32 value)
 Count the number of trailing zero bits in an integer value. Similar in behavior to the x86 instruction TZCNT. More...
 
static Int32 TrailingZeroCount (UInt64 value)
 Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT. More...
 
static Int32 TrailingZeroCount (UIntPtr value)
 Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT. More...
 

Detailed Description

Fallback implementations for Unity builds that cannot use the .NET versions.

Member Function Documentation

◆ LeadingZeroCount() [1/2]

static Int32 System.Numerics.BitOperations.LeadingZeroCount ( UInt32  value)
inlinestatic

Count the number of leading zero bits in a mask. Similar in behavior to the x86 instruction LZCNT.

Parameters
valueThe value.

◆ LeadingZeroCount() [2/2]

static Int32 System.Numerics.BitOperations.LeadingZeroCount ( UInt64  value)
inlinestatic

Count the number of leading zero bits in a mask. Similar in behavior to the x86 instruction LZCNT.

Parameters
valueThe value.

◆ IsPow2() [1/3]

static bool System.Numerics.BitOperations.IsPow2 ( UInt32  value)
inlinestatic

Evaluate whether a given integral value is a power of 2.

Parameters
valueThe value.

◆ IsPow2() [2/3]

static bool System.Numerics.BitOperations.IsPow2 ( UInt64  value)
inlinestatic

Evaluate whether a given integral value is a power of 2.

Parameters
valueThe value.

◆ IsPow2() [3/3]

static bool System.Numerics.BitOperations.IsPow2 ( UIntPtr  value)
inlinestatic

Evaluate whether a given integral value is a power of 2.

Parameters
valueThe value.

◆ Log2() [1/3]

static Int32 System.Numerics.BitOperations.Log2 ( UInt32  value)
inlinestatic

Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined.

Parameters
valueThe value.

◆ Log2() [2/3]

static Int32 System.Numerics.BitOperations.Log2 ( UInt64  value)
inlinestatic

Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined.

Parameters
valueThe value.

◆ Log2() [3/3]

static Int32 System.Numerics.BitOperations.Log2 ( UIntPtr  value)
inlinestatic

Returns the integer (floor) log of the specified value, base 2. Note that by convention, input value 0 returns 0 since log(0) is undefined.

Parameters
valueThe value.

◆ PopCount() [1/3]

static Int32 System.Numerics.BitOperations.PopCount ( UInt32  value)
inlinestatic

Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT.

Parameters
valueThe value.

◆ PopCount() [2/3]

static Int32 System.Numerics.BitOperations.PopCount ( UInt64  value)
inlinestatic

Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT.

Parameters
valueThe value.

◆ PopCount() [3/3]

static Int32 System.Numerics.BitOperations.PopCount ( UIntPtr  value)
inlinestatic

Returns the population count (number of bits set) of a mask. Similar in behavior to the x86 instruction POPCNT.

Parameters
valueThe value.

◆ RotateLeft() [1/3]

static UInt32 System.Numerics.BitOperations.RotateLeft ( UInt32  value,
Int32  offset 
)
inlinestatic

Rotates the specified value left by the specified number of bits. Similar in behavior to the x86 instruction ROL.

Parameters
valueThe value to rotate.
offsetThe number of bits to rotate by. Any value outside the range [0..31] is treated as congruent mod 32.
Returns
The rotated value.

◆ RotateLeft() [2/3]

static UInt64 System.Numerics.BitOperations.RotateLeft ( UInt64  value,
Int32  offset 
)
inlinestatic

Rotates the specified value left by the specified number of bits. Similar in behavior to the x86 instruction ROL.

Parameters
valueThe value to rotate.
offsetThe number of bits to rotate by. Any value outside the range [0..63] is treated as congruent mod 64.
Returns
The rotated value.

◆ RotateLeft() [3/3]

static UIntPtr System.Numerics.BitOperations.RotateLeft ( UIntPtr  value,
Int32  offset 
)
inlinestatic

Rotates the specified value left by the specified number of bits. Similar in behavior to the x86 instruction ROL.

Parameters
valueThe value to rotate.
offsetThe number of bits to rotate by. Any value outside the range [0..31] is treated as congruent mod 32 on a 32-bit process, and any value outside the range [0..63] is treated as congruent mod 64 on a 64-bit process.
Returns
The rotated value.

◆ RotateRight() [1/3]

static UInt32 System.Numerics.BitOperations.RotateRight ( UInt32  value,
Int32  offset 
)
inlinestatic

Rotates the specified value right by the specified number of bits. Similar in behavior to the x86 instruction ROR.

Parameters
valueThe value to rotate.
offsetThe number of bits to rotate by. Any value outside the range [0..31] is treated as congruent mod 32.
Returns
The rotated value.

◆ RotateRight() [2/3]

static UInt64 System.Numerics.BitOperations.RotateRight ( UInt64  value,
Int32  offset 
)
inlinestatic

Rotates the specified value right by the specified number of bits. Similar in behavior to the x86 instruction ROR.

Parameters
valueThe value to rotate.
offsetThe number of bits to rotate by. Any value outside the range [0..63] is treated as congruent mod 64.
Returns
The rotated value.

◆ RotateRight() [3/3]

static UIntPtr System.Numerics.BitOperations.RotateRight ( UIntPtr  value,
Int32  offset 
)
inlinestatic

Rotates the specified value right by the specified number of bits. Similar in behavior to the x86 instruction ROR.

Parameters
valueThe value to rotate.
offsetThe number of bits to rotate by. Any value outside the range [0..31] is treated as congruent mod 32 on a 32-bit process, and any value outside the range [0..63] is treated as congruent mod 64 on a 64-bit process.
Returns
The rotated value.

◆ RoundUpToPowerOf2() [1/3]

static UInt32 System.Numerics.BitOperations.RoundUpToPowerOf2 ( UInt32  value)
inlinestatic

Round the given integral value up to a power of 2.

Parameters
valueThe value.
Returns
The smallest power of 2 which is greater than or equal to value . If value is 0 or the result overflows, returns 0.

◆ RoundUpToPowerOf2() [2/3]

static UInt64 System.Numerics.BitOperations.RoundUpToPowerOf2 ( UInt64  value)
inlinestatic

Round the given integral value up to a power of 2.

Parameters
valueThe value.
Returns
The smallest power of 2 which is greater than or equal to value . If value is 0 or the result overflows, returns 0.

◆ RoundUpToPowerOf2() [3/3]

static UIntPtr System.Numerics.BitOperations.RoundUpToPowerOf2 ( UIntPtr  value)
inlinestatic

Round the given integral value up to a power of 2.

Parameters
valueThe value.
Returns
The smallest power of 2 which is greater than or equal to value . If value is 0 or the result overflows, returns 0.

◆ TrailingZeroCount() [1/6]

static Int32 System.Numerics.BitOperations.TrailingZeroCount ( Int32  value)
inlinestatic

Count the number of trailing zero bits in an integer value. Similar in behavior to the x86 instruction TZCNT.

Parameters
valueThe value.

◆ TrailingZeroCount() [2/6]

static Int32 System.Numerics.BitOperations.TrailingZeroCount ( Int64  value)
inlinestatic

Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT.

Parameters
valueThe value.

◆ TrailingZeroCount() [3/6]

static Int32 System.Numerics.BitOperations.TrailingZeroCount ( IntPtr  value)
inlinestatic

Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT.

Parameters
valueThe value.

◆ TrailingZeroCount() [4/6]

static Int32 System.Numerics.BitOperations.TrailingZeroCount ( UInt32  value)
inlinestatic

Count the number of trailing zero bits in an integer value. Similar in behavior to the x86 instruction TZCNT.

Parameters
valueThe value.

◆ TrailingZeroCount() [5/6]

static Int32 System.Numerics.BitOperations.TrailingZeroCount ( UInt64  value)
inlinestatic

Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT.

Parameters
valueThe value.

◆ TrailingZeroCount() [6/6]

static Int32 System.Numerics.BitOperations.TrailingZeroCount ( UIntPtr  value)
inlinestatic

Count the number of trailing zero bits in a mask. Similar in behavior to the x86 instruction TZCNT.

Parameters
valueThe value.