C# Класс Lucene.Net.Util.BitUtil

A variety of high efficiencly bit twiddling routines.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
ntzTable byte[]

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

Метод Описание
IsPowerOfTwo ( int v ) : bool

returns true if v is a power of two or zero

IsPowerOfTwo ( long v ) : bool

returns true if v is a power of two or zero

NextHighestPowerOfTwo ( int v ) : int

returns the next highest power of two, or the current value if it's already a power of two or zero

NextHighestPowerOfTwo ( long v ) : long

returns the next highest power of two, or the current value if it's already a power of two or zero

Ntz ( int val ) : int

Returns number of trailing zeros in a 32 bit int value.

Ntz ( long val ) : int

Returns number of trailing zeros in a 64 bit long value.

Ntz2 ( long x ) : int

returns 0 based index of first set bit (only works for x!=0)
This is an alternate implementation of ntz()

Ntz3 ( long x ) : int

returns 0 based index of first set bit
This is an alternate implementation of ntz()

Pop ( long x ) : int

Returns the number of bits set in the long

Pop_andnot ( long A, long B, int wordOffset, int numWords ) : long

Returns the popcount or cardinality of A & ~B Neither array is modified.

Pop_array ( long A, int wordOffset, int numWords ) : long

Returns the number of set bits in an array of longs.

Pop_intersect ( long A, long B, int wordOffset, int numWords ) : long

Returns the popcount or cardinality of the two sets after an intersection. Neither array is modified.

Pop_union ( long A, long B, int wordOffset, int numWords ) : long

Returns the popcount or cardinality of the union of two sets. Neither array is modified.

Pop_xor ( long A, long B, int wordOffset, int numWords ) : long

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

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

returns true if v is a power of two or zero
public static IsPowerOfTwo ( int v ) : bool
v int
Результат bool

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

returns true if v is a power of two or zero
public static IsPowerOfTwo ( long v ) : bool
v long
Результат bool

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

returns the next highest power of two, or the current value if it's already a power of two or zero
public static NextHighestPowerOfTwo ( int v ) : int
v int
Результат int

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

returns the next highest power of two, or the current value if it's already a power of two or zero
public static NextHighestPowerOfTwo ( long v ) : long
v long
Результат long

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

Returns number of trailing zeros in a 32 bit int value.
public static Ntz ( int val ) : int
val int
Результат int

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

Returns number of trailing zeros in a 64 bit long value.
public static Ntz ( long val ) : int
val long
Результат int

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

returns 0 based index of first set bit (only works for x!=0)
This is an alternate implementation of ntz()
public static Ntz2 ( long x ) : int
x long
Результат int

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

returns 0 based index of first set bit
This is an alternate implementation of ntz()
public static Ntz3 ( long x ) : int
x long
Результат int

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

Returns the number of bits set in the long
public static Pop ( long x ) : int
x long
Результат int

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

Returns the popcount or cardinality of A & ~B Neither array is modified.
public static Pop_andnot ( long A, long B, int wordOffset, int numWords ) : long
A long
B long
wordOffset int
numWords int
Результат long

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

Returns the number of set bits in an array of longs.
public static Pop_array ( long A, int wordOffset, int numWords ) : long
A long
wordOffset int
numWords int
Результат long

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

Returns the popcount or cardinality of the two sets after an intersection. Neither array is modified.
public static Pop_intersect ( long A, long B, int wordOffset, int numWords ) : long
A long
B long
wordOffset int
numWords int
Результат long

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

Returns the popcount or cardinality of the union of two sets. Neither array is modified.
public static Pop_union ( long A, long B, int wordOffset, int numWords ) : long
A long
B long
wordOffset int
numWords int
Результат long

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

public static Pop_xor ( long A, long B, int wordOffset, int numWords ) : long
A long
B long
wordOffset int
numWords int
Результат long

Описание свойств

ntzTable публичное статическое свойство

table of number of trailing zeros in a byte
public static byte[] ntzTable
Результат byte[]