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
This commit is contained in:
Thomas Davies 2016-11-08 14:31:55 +00:00
Родитель 05f540a1e3
Коммит 133c57c331
1 изменённых файлов: 2 добавлений и 6 удалений

Просмотреть файл

@ -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;
}