How does this Erlang function perform BSL for binary files?

Can someone drown out and explain how this piece of code from the previous answer works here ?

bbsl(Bin,Shift) -> <<_:Shift,Rest/bits>> = Bin, <<Rest/bits,0:Shift>>. 
+4
source share
1 answer
 bbsl(Bin, Shift) -> % function accepts binary and number << _:Shift, % match Shift number of bits into dummy variable _ and Rest/bits>> = Bin, % puts rest of the bits into Rest variable from Bin variable << Rest/bits, % start creating new binary with bits from Rest at beginning 0:Shift >>. % and Shift number of 0 in the end 

Hope that made sense

+4
source

All Articles