[erlang-questions] Bit Packing question

Santosh Kumar santosh79@REDACTED
Sat Dec 13 03:52:31 CET 2014

Hi group,
I was trying to pack a number into 4 bytes and was having a hard time doing
it. Here is what I was trying:

102> Num = 128.


103> <<Num:4/bytes>>.

** exception error: bad argument

While this works:

104> <<Num:32>>.


Here the packing into 32 bits works but the packing into 4 bytes fails. Not
sure why.

Any help, much appreciated.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20141212/9a06374f/attachment.htm>

More information about the erlang-questions mailing list