[Libav-user] Quick Question About align_get_bits()

Thilo Borgmann thilo.borgmann at mail.de
Thu Jan 15 06:31:07 CET 2015


Am 15.01.15 um 01:59 schrieb Marcus Johnson:
> The point of this function is to align the memory to the next byte, right?
> because as far as I can tell (and I may be wrong) it doesn't work.

Hmmmmm...

> x & 7 isn't accurate, I've found that the proper formula for skipping x bits
> (0-7) for the next byte is x * -1 % 8

For non-negative values (I assume we are never skipping/aligning backward, nor
that there is a negative number of bits left...)

x & 7 == x % 8

should be true.

-Thilo



More information about the Libav-user mailing list