Java Code Examples for it.unimi.dsi.io.InputBitStream#readLong()

The following examples show how to use it.unimi.dsi.io.InputBitStream#readLong() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CanonicalFast64CodeWordDecoder.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public int decode( final InputBitStream ibs ) throws IOException {
    final int[] lengthIncrement = this.lengthIncrement;
    final long[] lastCodeWordPlusOne = this.lastCodeWordPlusOne;
    int curr = 0, l; 
    long x;

    x = ibs.readLong( lengthIncrement[ curr ] );
    
    for(;;) {
        if ( x < lastCodeWordPlusOne[ curr ] ) return symbol[ (int)( howManyUpToBlock[ curr ] - lastCodeWordPlusOne[ curr ] + x ) ];
        l = lengthIncrement[ ++curr ];
        if ( l == 1 ) x = x << 1 | ibs.readBit();
        else x = x << l | ibs.readLong( l );
    }
}
 
Example 2
Source File: TestCanonicalHuffmanRabaCoder.java    From database with GNU General Public License v2.0 3 votes vote down vote up
long compare64(InputBitStream ibs, byte[] buf, int offset, int bits) throws IOException {
	ibs.position(offset);
	long v1 = ibs.readLong(bits);
	long v2 = BytesUtil.getBits64(buf, offset, bits);
	
	assertTrue(v1 == v2);
	
	return v1;

}