src/main/java/net/sourceforge/jaad/aac/error/BitsBuffer.java
public void concatBits(BitsBuffer a) {
		if(a.len==0) return;
		int al = a.bufa;
		int ah = a.bufb;

		int bl, bh;
		if(len>32) {
			//mask off superfluous high b bits
			bl = bufa;
			bh = bufb&((1<<(len-32))-1);
			//left shift a len bits
			ah = al<<(len-32);
			al = 0;
		}
		else {
			bl = bufa&((1<<(len))-1);
			bh = 0;
			ah = (ah<<(len))|(al>>(32-len));
			al = al<<len;
		}

		//merge
		bufa = bl|al;
		bufb = bh|ah;

		len += a.len;
	}
public void concatBits(BitsBuffer a) {
		if(a.len==0) return;
		int al = a.bufa;
		int ah = a.bufb;

		int bl, bh;
		if(len>32) {
			//mask off superfluous high b bits
			bl = bufa;
			bh = bufb&((1<<(len-32))-1);
			//left shift a len bits
			ah = al<<(len-32);
			al = 0;
		}
		else {
			bl = bufa&((1<<(len))-1);
			bh = 0;
			ah = (ah<<(len))|(al>>(32-len));
			al = al<<len;
		}

		//merge
		bufa = bl|al;
		bufb = bh|ah;

		len += a.len;
	}
public void concatBits ( BitsBuffer a ) { if ( a . len == 0 ) return ; int al = a . bufa ; int ah = a . bufb ; int bl , bh ; if ( len > 32 ) { //mask off superfluous high b bits bl = bufa ; bh = bufb & ( ( 1 << ( len - 32 ) ) - 1 ) ; //left shift a len bits ah = al << ( len - 32 ) ; al = 0 ; } else { bl = bufa & ( ( 1 << ( len ) ) - 1 ) ; bh = 0 ; ah = ( ah << ( len ) ) | ( al >> ( 32 - len ) ) ; al = al << len ; } //merge bufa = bl | al ; bufb = bh | ah ; len += a . len ; }
merge bits of a to b
merge bits of a to b