Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Static Public Member Functions | Static Public Attributes | List of all members
Lucene.Net.Util.BitUtil Class Reference

A variety of high efficiencly bit twiddling routines. More...

Static Public Member Functions

static int Pop (long x)
 Returns the number of bits set in the long
 
static long Pop_array (long[] A, int wordOffset, int numWords)
 Returns the number of set bits in an array of longs.
 
static long Pop_intersect (long[] A, long[] B, int wordOffset, int numWords)
 Returns the popcount or cardinality of the two sets after an intersection. Neither array is modified.
 
static long Pop_union (long[] A, long[] B, int wordOffset, int numWords)
 Returns the popcount or cardinality of the union of two sets. Neither array is modified.
 
static long Pop_andnot (long[] A, long[] B, int wordOffset, int numWords)
 Returns the popcount or cardinality of A & ~B Neither array is modified.
 
static long Pop_xor (long[] A, long[] B, int wordOffset, int numWords)
 
static int Ntz (long val)
 Returns number of trailing zeros in a 64 bit long value.
 
static int Ntz (int val)
 Returns number of trailing zeros in a 32 bit int value.
 
static int Ntz2 (long x)
 returns 0 based index of first set bit (only works for x!=0)
This is an alternate implementation of ntz()
 
static int Ntz3 (long x)
 returns 0 based index of first set bit
This is an alternate implementation of ntz()
 
static bool IsPowerOfTwo (int v)
 returns true if v is a power of two or zero
 
static bool IsPowerOfTwo (long v)
 returns true if v is a power of two or zero
 
static int NextHighestPowerOfTwo (int v)
 returns the next highest power of two, or the current value if it's already a power of two or zero
 
static long NextHighestPowerOfTwo (long v)
 returns the next highest power of two, or the current value if it's already a power of two or zero
 

Static Public Attributes

static readonly byte[] ntzTable
 table of number of trailing zeros in a byte
 

Detailed Description

A variety of high efficiencly bit twiddling routines.

<version> $Id$ </version>

Definition at line 30 of file BitUtil.cs.

Member Function Documentation

static bool Lucene.Net.Util.BitUtil.IsPowerOfTwo ( int  v)
static

returns true if v is a power of two or zero

Definition at line 856 of file BitUtil.cs.

static bool Lucene.Net.Util.BitUtil.IsPowerOfTwo ( long  v)
static

returns true if v is a power of two or zero

Definition at line 862 of file BitUtil.cs.

static int Lucene.Net.Util.BitUtil.NextHighestPowerOfTwo ( int  v)
static

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

Definition at line 868 of file BitUtil.cs.

static long Lucene.Net.Util.BitUtil.NextHighestPowerOfTwo ( long  v)
static

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

Definition at line 881 of file BitUtil.cs.

static int Lucene.Net.Util.BitUtil.Ntz ( long  val)
static

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

Definition at line 726 of file BitUtil.cs.

static int Lucene.Net.Util.BitUtil.Ntz ( int  val)
static

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

Definition at line 776 of file BitUtil.cs.

static int Lucene.Net.Util.BitUtil.Ntz2 ( long  x)
static

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

Definition at line 800 of file BitUtil.cs.

static int Lucene.Net.Util.BitUtil.Ntz3 ( long  x)
static

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

Definition at line 822 of file BitUtil.cs.

static int Lucene.Net.Util.BitUtil.Pop ( long  x)
static

Returns the number of bits set in the long

Definition at line 34 of file BitUtil.cs.

static long Lucene.Net.Util.BitUtil.Pop_andnot ( long[]  A,
long[]  B,
int  wordOffset,
int  numWords 
)
static

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

Definition at line 450 of file BitUtil.cs.

static long Lucene.Net.Util.BitUtil.Pop_array ( long[]  A,
int  wordOffset,
int  numWords 
)
static

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

Definition at line 60 of file BitUtil.cs.

static long Lucene.Net.Util.BitUtil.Pop_intersect ( long[]  A,
long[]  B,
int  wordOffset,
int  numWords 
)
static

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

Definition at line 204 of file BitUtil.cs.

static long Lucene.Net.Util.BitUtil.Pop_union ( long[]  A,
long[]  B,
int  wordOffset,
int  numWords 
)
static

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

Definition at line 324 of file BitUtil.cs.

static long Lucene.Net.Util.BitUtil.Pop_xor ( long[]  A,
long[]  B,
int  wordOffset,
int  numWords 
)
static

Definition at line 573 of file BitUtil.cs.

Member Data Documentation

readonly byte [] Lucene.Net.Util.BitUtil.ntzTable
static
Initial value:
= new byte[]
{
8, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1,
0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0,
1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2,
0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0,
2, 0, 1, 0, 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1,
0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0,
1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5,
0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0,
3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1,
0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0,
1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2,
0, 1, 0
}

table of number of trailing zeros in a byte

Definition at line 708 of file BitUtil.cs.


The documentation for this class was generated from the following file: