C# Class System.Xml.Bits

Contains static utility methods used to manipulate bits in a word.
Afficher le fichier Open project: gbarnett/shared-source-cli-2.0 Class Usage Examples

Méthodes publiques

Méthode Description
ClearLeast ( uint num ) : uint

Clear the least significant bit that is set and return the result.

Count ( uint num ) : int

Returns the number of 1 bits in an unsigned integer. Counts bits by divide-and-conquer method, first computing 16 2-bit counts, then 8 4-bit counts, then 4 8-bit counts, then 2 16-bit counts, and finally 1 32-bit count.

ExactlyOne ( uint num ) : bool

Returns true if the unsigned integer has exactly one bit set.

LeastPosition ( uint num ) : int

Compute the 1-based position of the least sigificant bit that is set, and return it (return 0 if no bits are set). (e.g. 0x1001100 will return 3, since the 3rd bit is set).

MoreThanOne ( uint num ) : bool

Returns true if the unsigned integer has more than one bit set.

Method Details

ClearLeast() public static méthode

Clear the least significant bit that is set and return the result.
public static ClearLeast ( uint num ) : uint
num uint
Résultat uint

Count() public static méthode

Returns the number of 1 bits in an unsigned integer. Counts bits by divide-and-conquer method, first computing 16 2-bit counts, then 8 4-bit counts, then 4 8-bit counts, then 2 16-bit counts, and finally 1 32-bit count.
public static Count ( uint num ) : int
num uint
Résultat int

ExactlyOne() public static méthode

Returns true if the unsigned integer has exactly one bit set.
public static ExactlyOne ( uint num ) : bool
num uint
Résultat bool

LeastPosition() public static méthode

Compute the 1-based position of the least sigificant bit that is set, and return it (return 0 if no bits are set). (e.g. 0x1001100 will return 3, since the 3rd bit is set).
public static LeastPosition ( uint num ) : int
num uint
Résultat int

MoreThanOne() public static méthode

Returns true if the unsigned integer has more than one bit set.
public static MoreThanOne ( uint num ) : bool
num uint
Résultat bool