[erlang-questions] bit syntax: 0-sized segments
Fri Mar 8 08:58:42 CET 2013
On 8 Mar 2013, at 08:38, Dan Gudmundsson wrote:
> Another nice thing with 0 sized integers is when you add alignment
> bits in protocols, in both
> matching and creation.
I make use of this in sext as well, in a number of places:
Pad = 8 - (size(B) rem 8),
<< (<< <<1:1, B1:8>> || <<B1>> <= B >>)/bitstring, 0:Pad, 8 >>.
Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
More information about the erlang-questions