예제 #1
0
 @Override
 public int nextAsInt() {
   long t = w & -w;
   int answer = (x + 1) * 64 - 1 - Long.bitCount(t - 1);
   w ^= t;
   while (w == 0) {
     --x;
     if (x < 0) break;
     w = Long.reverse(bitmap[x]);
   }
   return answer;
 }
예제 #2
0
 void wrap(long[] b) {
   bitmap = b;
   for (x = bitmap.length - 1; x >= 0; --x) if ((w = Long.reverse(bitmap[x])) != 0) break;
 }