Bits2words() public static method

returns the number of 64 bit words it would take to hold numBits
public static Bits2words ( long numBits ) : int
numBits long
return int
Exemplo n.º 1
0
        private LongBitSet MakeLongFixedBitSet(int[] a, int numBits)
        {
            LongBitSet bs;

            if (Random().NextBoolean())
            {
                int    bits2words = LongBitSet.Bits2words(numBits);
                long[] words      = new long[bits2words + Random().Next(100)];
                for (int i = bits2words; i < words.Length; i++)
                {
                    words[i] = Random().NextLong();
                }
                bs = new LongBitSet(words, numBits);
            }
            else
            {
                bs = new LongBitSet(numBits);
            }
            foreach (int e in a)
            {
                bs.Set(e);
            }
            return(bs);
        }