[erlang-questions] sub-byte endianness in bit syntax
David Mercer
dmercer@REDACTED
Thu Aug 16 22:30:17 CEST 2007
At Thursday, August 16, 2007 14:47, Michael McDaniel wrote:
> On Thu, Aug 16, 2007 at 06:54:03PM +0100, Tony Finch wrote:
> > How do you tell Erlang to fill bytes little-end first?
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>
> documentation, programming examples, section 4.3
. . .
I think what Tony is asking about is little-endian *bit* order as opposed to
byte order.
I think Erlang's endianness is at the byte level, not bit level. Therefore,
<< 2#11110000:8/little >> = << 2#11110000:8/big >>
regardless of the endianness, since it is only one byte, and the bits within
a byte are filled in big-endian order always. Once we go over a byte
boundary, however, endianness does matter:
<< 2#11110000:16/little >> = << 2#11110000:16/big >>
will not match.
This request may be related to EEP #4
(http://www.erlang.org/eeps/eep-0004.html), since it seems to be related to
bit streams as opposed to byte streams.
More information about the erlang-questions
mailing list