Erlang/OTP Forums

Author Message

<  Erlang questions mailing list  ~  Split integer into bytes

Qrilka
Posted: Sun Jul 22, 2007 10:22 am Reply with quote
User Joined: 21 Sep 2006 Posts: 141
Is there some 'normal' way to split integer (32 bits) into bytes?
Right now I do this using
View user's profile Send private message
Guest
Posted: Sun Jul 22, 2007 10:41 am Reply with quote
Guest
<<B4:8, B3:8, B2:8, B1:8>> = <<NUMBER:32>>.

--
dda

On 7/22/07, Kirill Zaborski <qrilka@gmail.com> 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 Cool) bsr 8,
> (X band (255 bsl 16)) bsr 16,
> (X band (255 bsl 24)) bsr 24]
>
>
> Regard,
> Kirill.
_______________________________________________
erlang-questions mailing list
erlang-questions@erlang.org
http://www.erlang.org/mailman/listinfo/erlang-questions
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum