[erlang-questions] Binary manipulation
Sun Mar 13 11:03:57 CET 2011
Having received only one private reply which would not really scale up
and having looked quite closely at all the API's available I can't see
any way to manipulate binary data with any efficiency. I am therefore
thinking of doing a NIF library. However I'm a bit concerned about what
the following statement means:
"Avoid doing lengthy work in NIF calls as that may degrade the
responsiveness of the VM. NIFs are called directly by the same scheduler
thread that executed the calling Erlang code. The calling scheduler will
thus be blocked from doing any other work until the NIF returns."
I presume this just means the calling process cannot do any other work
until the NIF returns and not that all processes can suffer degradation.
On 11/03/2011 09:01, Bob Cowdery wrote:
> I would appreciate any advice/ideas on how to efficiently handle a large
> The binary in question has a couple of protocol wrappers around it which
> are no problem as the bit syntax easily copes with that. What I'm not
> sure of is how to handle the data.
> <<I:24, Q:24, M:16 ... repeated 63 times >>
> What I have to do is extract I and Q which are 24 bit le values and end
> up with another binary which is:
> <<I/float, Q/float ... repeated 63 times (see below) >>
> Where I and Q are now floating point numbers. I will need M in the
> future, but not right now. It's a little more complicated than that
> because several of the raw data binaries will go into the processed
> binary which will be a multiple of 64 up to 1024.
> I will also need to do the opposite, i.e. take the processed binary and
> transform it back to the raw data binary.
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:
More information about the erlang-questions