[erlang-questions] How to efficiently set the bit at position Index to 1 in a binary?

Zabrane Mickael zabrane3@REDACTED
Sun Dec 25 23:47:05 CET 2011


On Dec 25, 2011, at 8:19 PM, Torben Hoffmann wrote:

> Following that you can write it like:
> set2(N, Bin) ->
> <<L:N/bits, _:1, R/bits>> = Bin, % LINE 271
> <<L/bits, 1:1, R/bits>>.


on my machine (R15B, R14B04), the warning is still reported.
src/foo.erl:271: Warning: NOT OPTIMIZED: sub binary is used or returned

Regards,
Zabrane

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


More information about the erlang-questions mailing list