Decoding bitmask?

Ericsson, Björn bjorn.ericsson@REDACTED
Tue Dec 20 09:34:29 CET 2005


Hello!
 
I'm working on decoding a binary message. The first variables are Mandatory, so they are easy to decode. The last of the mandatory variables is an 16 bit option mask where each bit corresponds to an optional variable that might follow directly after the OptionMask.
 
How can I decode this OptionMask, and then parse the optional variables, in the cleanest  and most "Erlang optimized" way?
 
<<Mandatory1, Mandatory2, OptionMask:16/binary, Rest/binary>> = Message,
etc...
 
/BE


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20051220/b430c338/attachment.htm>


More information about the erlang-questions mailing list