Help with bit pattern

Bob Ippolito <>
Thu Aug 24 19:47:44 CEST 2006


On 8/24/06, Joel Reymont <> wrote:
> Folks,
>
> What's the proper way to say this?
>
> <<NBits1:5, Xmin:NBits/signed, Xmax:NBits/signed, Ymin:NBits/signed,
> Ymax:NBits/signed, _:((NBits1 * 4) rem 8), FrameRate:16/little,
> FrameCount:16/little, _/binary>> = X.

I see you're reading a SWF header... The padding size should be (8 -
((5 + NBits1 * 4) rem 8)). I don't think that bit syntax is going to
work directly anyway because IIRC SWF files store bits in MSB first
order(!) for variable bit length fields.

-bob



More information about the erlang-questions mailing list