Click or drag to resize

BitMath Class

Contains some random and useful functions.
Inheritance Hierarchy
SystemObject
  GSFBitMath

Namespace: GSF
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.207-beta+1781b796b2aa7a54013a031eb432fe4ccee31867
Syntax
public static class BitMath
View Source

The BitMath type exposes the following members.

Methods
 NameDescription
Public methodStatic memberCountBitsCleared(UInt32) Counts the number of bits that are not set
Public methodStatic memberCountBitsCleared(UInt64) Counts the number of bits that are not set
Public methodStatic memberCountBitsSet(UInt32) Counts the number of bits that are set
Public methodStatic memberCountBitsSet(UInt64) Counts the number of bits that are set
Public methodStatic memberCountLeadingOnes(UInt32) Counts the number of consecutive 1's starting from the highest bit working down.
Public methodStatic memberCountLeadingOnes(UInt64) Counts the number of consecutive 1's starting from the highest bit working down.
Public methodStatic memberCountLeadingZeros(UInt32) Counts the number of consecutive 0's starting from the highest bit working down.
Public methodStatic memberCountLeadingZeros(UInt64) Counts the number of consecutive 0's starting from the highest bit working down.
Public methodStatic memberCountTrailingOnes(UInt32) Counts the number of consecutive 1's starting from the lowest bit working up.
Public methodStatic memberCountTrailingOnes(UInt64) Counts the number of consecutive 1's starting from the lowest bit working up.
Public methodStatic memberCountTrailingZeros(UInt32) Counts the number of consecutive 0's starting from the lowest bit working up.
Public methodStatic memberCountTrailingZeros(UInt64) Counts the number of consecutive 0's starting from the lowest bit working up.
Public methodStatic memberCreateBitMask Creates a bit mask for a number with the given number of bits.
Public methodStatic memberGetClearedBitPositions(UInt32) Returns the bit position for every bit that is cleared in the provided value. Bit positions are defined as 0-31;
Public methodStatic memberGetClearedBitPositions(UInt64) Returns the bit position for every bit that is cleared in the provided value. Bit positions are defined as 0-63;
Public methodStatic memberGetSetBitPositions(UInt32) Returns the bit position for every bit that is set in the provided value. Bit positions are defined as 0-31;
Public methodStatic memberGetSetBitPositions(UInt64) Returns the bit position for every bit that is set in the provided value. Bit positions are defined as 0-63;
Public methodStatic memberIsPowerOfTwo(Int32) Determines if the number is a power of 2.
Public methodStatic memberIsPowerOfTwo(Int64) Determines if the number is a power of 2.
Public methodStatic memberIsPowerOfTwo(UInt32) Determines if the number is a power of 2.
Public methodStatic memberIsPowerOfTwo(UInt64) Determines if the number is a power of 2.
Public methodStatic memberRoundDownToNearestPowerOfTwo(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 methodStatic memberRoundDownToNearestPowerOfTwo(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 methodStatic memberRoundUpToNearestPowerOfTwo(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 methodStatic memberRoundUpToNearestPowerOfTwo(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

Reference

GSF Namespace