[erlang-questions] Split integer into bytes

dda <>
Sun Jul 22 12:37:56 CEST 2007


<<B4:8, B3:8, B2:8, B1:8>> = <<NUMBER:32>>.

-- 
dda

On 7/22/07, Kirill Zaborski <> wrote:
> Is there some 'normal' way to split integer (32 bits) into bytes?
> Right now I do this using
>      [ X band 255,
>       (X band (255 bsl 8)) bsr 8,
>       (X band (255 bsl 16)) bsr 16,
>       (X band (255 bsl 24)) bsr 24]
>
>
> Regard,
> Kirill.



More information about the erlang-questions mailing list