construct binary

Stephen Han kruegger@REDACTED
Thu Jul 7 01:59:47 CEST 2005


Hello

I am trying to write a IS-683 PRL encode/decode tool for our testing.

One of the parameter format is 
----------------------------------
NUM_CHANS | 5 BITS
----------------------------------

*NUM_CHANS occurrences of the following field:

-----------------------------------
CHAN            | 11 BITS
------------------------------------

* finally pad some bits to fit into the byte

-----------------------------------
RESERVED  | As Required
------------------------------------

So if the number of channel is 2 then

0                                                          31
+-----------+--------------+--------------+-------------+
    5bit         11bit         11bit          5 bit(for padding)
+-----------+--------------+--------------+-------------+

Trying to use the bit syntax in Erlang but gives me hard time... 
Can anybody demonstrate Erlang way to write it?

regards,



More information about the erlang-questions mailing list