Class BitUtil
  
  A variety of high efficiency bit twiddling routines.
This is a Lucene.NET INTERNAL API, use at your own risk
    Inheritance
    System.Object
    BitUtil
   
  
    Inherited Members
    
      System.Object.Equals(System.Object)
    
    
      System.Object.Equals(System.Object, System.Object)
    
    
      System.Object.GetHashCode()
    
    
      System.Object.GetType()
    
    
      System.Object.MemberwiseClone()
    
    
      System.Object.ReferenceEquals(System.Object, System.Object)
    
    
      System.Object.ToString()
    
   
  
  Assembly: Lucene.Net.dll
  Syntax
  
    public static class BitUtil
   
  Methods
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  BitCount(Byte)
  Return the number of bits sets in b. 
Declaration
  
    public static int BitCount(byte b)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Byte | b |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int32 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  BitList(Byte)
  Return the list of bits which are set in b encoded as followed:
(i >>> (4 * n)) & 0x0F
 is the offset of the n-th set bit of
the given byte plus one, or 0 if there are n or less bits set in the given
byte. For example 
bitList(12)
 returns 0x43:
- 0x43 & 0x0F
 is 3, meaning the the first bit set is at offset 3-1 = 2,
- (0x43 >>> 4) & 0x0F
 is 4, meaning there is a second bit set at offset 4-1=3,
- (0x43 >>> 8) & 0x0F
 is 0, meaning there is no more bit set in this byte.
Declaration
  
    public static int BitList(byte b)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Byte | b |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int32 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  NextHighestPowerOfTwo(Int32)
  Returns the next highest power of two, or the current value if it's already a power of two or zero 
Declaration
  
    public static int NextHighestPowerOfTwo(int v)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int32 | v |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int32 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  NextHighestPowerOfTwo(Int64)
  Returns the next highest power of two, or the current value if it's already a power of two or zero 
Declaration
  
    public static long NextHighestPowerOfTwo(long v)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int64 | v |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int64 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Pop_AndNot(Int64[], Int64[], Int32, Int32)
  Returns the popcount or cardinality of A & ~B.
Neither array is modified.
Declaration
  
    public static long Pop_AndNot(long[] arr1, long[] arr2, int wordOffset, int numWords)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int64[] | arr1 |  | 
      
        | System.Int64[] | arr2 |  | 
      
        | System.Int32 | wordOffset |  | 
      
        | System.Int32 | numWords |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int64 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Pop_Array(Int64[], Int32, Int32)
  Returns the number of set bits in an array of System.Int64s. 
Declaration
  
    public static long Pop_Array(long[] arr, int wordOffset, int numWords)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int64[] | arr |  | 
      
        | System.Int32 | wordOffset |  | 
      
        | System.Int32 | numWords |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int64 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Pop_Intersect(Int64[], Int64[], Int32, Int32)
  Returns the popcount or cardinality of the two sets after an intersection.
Neither array is modified.
Declaration
  
    public static long Pop_Intersect(long[] arr1, long[] arr2, int wordOffset, int numWords)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int64[] | arr1 |  | 
      
        | System.Int64[] | arr2 |  | 
      
        | System.Int32 | wordOffset |  | 
      
        | System.Int32 | numWords |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int64 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Pop_Union(Int64[], Int64[], Int32, Int32)
  Returns the popcount or cardinality of the union of two sets.
Neither array is modified.
Declaration
  
    public static long Pop_Union(long[] arr1, long[] arr2, int wordOffset, int numWords)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int64[] | arr1 |  | 
      
        | System.Int64[] | arr2 |  | 
      
        | System.Int32 | wordOffset |  | 
      
        | System.Int32 | numWords |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int64 |  | 
    
  
  
    |
    Improve this Doc
  
  
    View Source
  
  
  Pop_Xor(Int64[], Int64[], Int32, Int32)
  Returns the popcount or cardinality of A ^ B
Neither array is modified.
Declaration
  
    public static long Pop_Xor(long[] arr1, long[] arr2, int wordOffset, int numWords)
   
  Parameters
  
    
      
        | Type | Name | Description | 
    
    
      
        | System.Int64[] | arr1 |  | 
      
        | System.Int64[] | arr2 |  | 
      
        | System.Int32 | wordOffset |  | 
      
        | System.Int32 | numWords |  | 
    
  
  Returns
  
    
      
        | Type | Description | 
    
    
      
        | System.Int64 |  |