about summary refs log tree commit diff
path: root/unpacker/src/main.rs
blob: 047b4c51015f3d88ad829b9c43126f962727d9e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use unpacker::Unpacker;

fn main() {
	// Four bits padding at the end.
	let testdata = vec![
		0b10000000, 0b00010000, 0b00000010, 0b00000000, 0b01000000, 0b00001000, 0b00000001,
		0b00000000, 0b00100000, 0b00000100, 0b00000000, 0b10000000, 0b00010000,
	];

	let mut up = Unpacker {
		out: vec![],
		work: 0,
		work_idx: 0,
	};

	for byte in testdata {
		up.push(byte);
	}
	up.finish();

	for chnk in up.out.chunks(2) {
		println!("{:08b} {:08b}", chnk[0], chnk[1]);
	}
}