[erlang-questions] Bitstring question

Mike Oxford moxford@REDACTED
Wed Feb 12 07:36:59 CET 2014


<< 0:2, D >> should concat the two.  Erlang knows what D is.
<<0:2/bits, D:6/bits>> should construct a single 8-bit value.
<<D/integer>> should (IMO) be valid because the value (33) is within the
range of /integer

How would you convert it back out to 33?


On Tue, Feb 11, 2014 at 10:32 PM, Dmitry Kolesnikov
<dmkolesnikov@REDACTED>wrote:

> Hello,
>
> Please see comments inline.
>
> Best Regards,
> Dmitry >-|-|-(*>
>
>
> > On 12.2.2014, at 8.27, Mike Oxford <moxford@REDACTED> wrote:
> >
> > D = <<33:6>>
> > <<33:6>>
> D is length 6 bit
> >
> > I want to convert that 6 bit value (33) into a numeric value.
> >
> > Why does <<0:2, D>> not work?
> Type and size is not specified
> > Why does <<0:2/bits, D:6/bits>> not work?
> Expected size is 8 bits but your bit string is 6
> > Why does <<D/integer>> not work?
> Integer is 32bit
>
> >
> > Thanks in advance!
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140211/02c8cdd8/attachment.htm>


More information about the erlang-questions mailing list