Commit 133c57c3 authored by Thomas Davies's avatar Thomas Davies

Support overwriting an arbitrary number of literal bits.

Overwriting was only guaranteed to work if a whole number
of bytes were being overwritten.

Change-Id: I5e72cb337ec6ff691e93288de9f751b583654a17
parent 05f540a1
......@@ -23,12 +23,8 @@ void aom_wb_write_bit(struct aom_write_bit_buffer *wb, int bit) {
const int off = (int)wb->bit_offset;
const int p = off / CHAR_BIT;
const int q = CHAR_BIT - 1 - off % CHAR_BIT;
if (q == CHAR_BIT - 1) {
wb->bit_buffer[p] = bit << q;
} else {
wb->bit_buffer[p] &= ~(1 << q);
wb->bit_buffer[p] |= bit << q;
}
wb->bit_buffer[p] &= ~(1 << q);
wb->bit_buffer[p] |= bit << q;
wb->bit_offset = off + 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment