Erlang binary concatenation

so I have the following A = <<1:1>> and B = <<1>>. Any built-in function (or a couple of lines of code) to combine these two binary files, the total size of which should be 16 bits ?

You have already tried the following:

 C = <<B/binary,A:8/bitstring>>. C = <<B/binary,A:8/binary>>. C = <<B/binary,A:8>>. C = <<B/binary,A/bitstring>>. 

This works, but the size will be 9 bits long.

PS I do not want 8 lines of erlang code as a solution.

+4
source share
1 answer

You probably need to add a few add-ons:

 << B/binary, 0:7, A/bitstring >>. 
+6
source

Source: https://habr.com/ru/post/1388256/


All Articles