[erlang-questions] sub-byte endianness in bit syntax

Tony Finch dot@REDACTED
Wed Aug 22 02:51:18 CEST 2007


On Thu, 16 Aug 2007, David Mercer wrote:
>
> 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.

Exactly. This is relevant to interoperability with C, which on
little-endian machines usually packs bit-fields into bytes little end
first. So I don't think there's a neat way to describe a structure like
the following in Erlang.

        struct {
                int a:4;
                int b:8;
                int c:12;
        } s;

Tony.
-- 
f.a.n.finch  <dot@REDACTED>  http://dotat.at/
IRISH SEA: SOUTHERLY, BACKING NORTHEASTERLY FOR A TIME, 3 OR 4. SLIGHT OR
MODERATE. SHOWERS. MODERATE OR GOOD, OCCASIONALLY POOR.



More information about the erlang-questions mailing list