Click or drag to resize

BitMath Methods

The BitMath type exposes the following members.

Methods
  Name Description
Public method Static member CountBitsCleared(UInt32) Counts the number of bits that are not set
Public method Static member CountBitsCleared(UInt64) Counts the number of bits that are not set
Public method Static member CountBitsSet(UInt32) Counts the number of bits that are set
Public method Static member CountBitsSet(UInt64) Counts the number of bits that are set
Public method Static member CountLeadingOnes(UInt32) Counts the number of consecutive 1's starting from the highest bit working down.
Public method Static member CountLeadingOnes(UInt64) Counts the number of consecutive 1's starting from the highest bit working down.
Public method Static member CountLeadingZeros(UInt32) Counts the number of consecutive 0's starting from the highest bit working down.
Public method Static member CountLeadingZeros(UInt64) Counts the number of consecutive 0's starting from the highest bit working down.
Public method Static member CountTrailingOnes(UInt32) Counts the number of consecutive 1's starting from the lowest bit working up.
Public method Static member CountTrailingOnes(UInt64) Counts the number of consecutive 1's starting from the lowest bit working up.
Public method Static member CountTrailingZeros(UInt32) Counts the number of consecutive 0's starting from the lowest bit working up.
Public method Static member CountTrailingZeros(UInt64) Counts the number of consecutive 0's starting from the lowest bit working up.
Public method Static member CreateBitMask Creates a bit mask for a number with the given number of bits.
Public method Static member GetClearedBitPositions(UInt32) Returns the bit position for every bit that is cleared in the provided value. Bit positions are defined as 0-31;
Public method Static member GetClearedBitPositions(UInt64) Returns the bit position for every bit that is cleared in the provided value. Bit positions are defined as 0-63;
Public method Static member GetSetBitPositions(UInt32) Returns the bit position for every bit that is set in the provided value. Bit positions are defined as 0-31;
Public method Static member GetSetBitPositions(UInt64) Returns the bit position for every bit that is set in the provided value. Bit positions are defined as 0-63;
Public method Static member IsPowerOfTwo(Int32) Determines if the number is a power of 2.
Public method Static member IsPowerOfTwo(Int64) Determines if the number is a power of 2.
Public method Static member IsPowerOfTwo(UInt32) Determines if the number is a power of 2.
Public method Static member IsPowerOfTwo(UInt64) Determines if the number is a power of 2.
Public method Static member RoundDownToNearestPowerOfTwo(UInt32) Rounds a number down to the nearest power of 2. If the value is a power of two, the same value is returned. If value is zero, 1 is returned.
Public method Static member RoundDownToNearestPowerOfTwo(UInt64) Rounds a number down to the nearest power of 2. If the value is a power of two, the same value is returned. If value is zero, one is returned.
Public method Static member RoundUpToNearestPowerOfTwo(UInt32) Rounds a number up to the nearest power of 2. If the value is a power of two, the same value is returned. If the value is larger than the largest power of 2. It is rounded down.
Public method Static member RoundUpToNearestPowerOfTwo(UInt64) Rounds a number up to the nearest power of 2. If the value is a power of two, the same value is returned. If the value is larger than the largest power of 2. It is rounded down.
Top
See Also