C# Класс System.Xml.Bits

Contains static utility methods used to manipulate bits in a word.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Описание методов

ClearLeast() публичный статический Метод

Clear the least significant bit that is set and return the result.
public static ClearLeast ( uint num ) : uint
num uint
Результат uint

Count() публичный статический Метод

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
Результат int

ExactlyOne() публичный статический Метод

Returns true if the unsigned integer has exactly one bit set.
public static ExactlyOne ( uint num ) : bool
num uint
Результат bool

LeastPosition() публичный статический Метод

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
Результат int

MoreThanOne() публичный статический Метод

Returns true if the unsigned integer has more than one bit set.
public static MoreThanOne ( uint num ) : bool
num uint
Результат bool