[erlang-questions] bit syntax: 0-sized segments
Fri Mar 8 09:32:38 CET 2013
On 03/08/2013 08:58 AM, Ulf Wiger wrote:
> 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:
> encode_bin_elems(<<>>) ->
> encode_bin_elems(B) ->
> Pad = 8 - (size(B) rem 8),
> << (<< <<1:1, B1:8>> ||<<B1>> <= B>>)/bitstring, 0:Pad, 8>>.
I fail to see where this creates a 0-sized integer...
More information about the erlang-questions