package jp.phdax.bitvector;

public class BitVector {
	
	private final int size;
	private final long[] bits;
	private int[] rankIdx;
	private int[] selectIdx;
	private int wholeRank1;
	
	BitVector(int size, long[] bits) {
		this.size = size;
		this.bits = bits;
		
		rankIdx = new int[bits.length];
		selectIdx = new int[bits.length];
		
		int sum=0;
		int decimal64 = 0;
		for(int i=0; i<bits.length; i++) {
			//rank用インデックス：各longのtrueビットの累積値を記録する
			rankIdx[i] = sum;
			sum += Long.bitCount(bits[i]);
			//select用インデックス：trueビットが累積で64の倍数を超えた位置を記録していく
			if(decimal64 * 64 < sum) {
				selectIdx[decimal64] = decimal64*64 + bitPos(bits[i], sum%64);
				decimal64++;
			}
		}
	}
	
	public boolean pos(int idx) {
		return false;
	}
	
	public int rank1(int idx) {
		return 0;
	}
	
	public int rank0(int idx) {
		return 0;
	}

	public int select1(int rank) {
		return 0;
	}
	
	public int select0(int rank) {
		return 0;
	}
	
	private static final int bitPos(long bits, int num) {
		return 0;
	}
}

@@ -177,16 +177,65 @@
 eRank1;%0A
+%09private static final long MOD64MASK = 0b111111;%0A
 %09%0A%09BitVe
@@ -767,13 +767,58 @@
 urn 
-false
+((bits%5Bidx %3E%3E%3E 6%5D %3E%3E%3E (idx & MOD64MASK)) & 1) != 0
 ;%0A%09%7D

implement bit method