[erlang-questions] How to create a bit array / bit vector

dieter@REDACTED dieter@REDACTED
Wed Feb 27 14:41:52 CET 2019


Hi,
how about
new(Max) ->
  .
This creates a binary with Max bits, with the MSB set to 1.
I found this doc page very helpful:
http://erlang.org/doc/programming_examples/bit_syntax.html (http://erlang.org/doc/programming_examples/bit_syntax.html)
Kind regards,
Dieter
Am Mi., Febr. 27, 2019 06:13 schrieb maverik a : 
Hi All,
I'm trying to create a bit array in Erlang with simple new() , set() and get() operations. 
My new() looks like: 
new(Max) -> 
 N = 1 bsl Max-1,
 .
but problem I'm stuck with is, my max can be at most 8 .
How can I create a bitstring of Max length ? 
Regards
Maverick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20190227/664874e0/attachment.htm>


More information about the erlang-questions mailing list