GetBits() public method

public GetBits ( ) : Bits
return Bits
示例#1
0
 /// <summary>
 /// If the given <see cref="FixedBitSet"/> is large enough to hold <paramref name="numBits"/>,
 /// returns the given bits, otherwise returns a new <see cref="FixedBitSet"/> which
 /// can hold the requested number of bits.
 ///
 /// <para/>
 /// <b>NOTE:</b> the returned bitset reuses the underlying <see cref="T:long[]"/> of
 /// the given <paramref name="bits"/> if possible. Also, calling <see cref="Length"/> on the
 /// returned bits may return a value greater than <paramref name="numBits"/>.
 /// </summary>
 public static FixedBitSet EnsureCapacity(FixedBitSet bits, int numBits)
 {
     if (numBits < bits.Length)
     {
         return(bits);
     }
     else
     {
         int    numWords = Bits2words(numBits);
         long[] arr      = bits.GetBits();
         if (numWords >= arr.Length)
         {
             arr = ArrayUtil.Grow(arr, numWords + 1);
         }
         return(new FixedBitSet(arr, arr.Length << 6));
     }
 }