[erlang-questions] idea: endianess in interoperability tutorials

Lev Walkin <>
Fri Dec 14 13:36:42 CET 2007

Samuel Rivas wrote:
> Hi,
> Interoperability tutorials examples use non-portable code to read message length
> with erl_interface. For example:
>   len = (buf[0] << 8) | buf[1];
> works only on little-endian platforms.

This is not true.

> I suggest a minor patch that make them a bit more portable. It might be good
> idea to apply it in the documentation, I have found the original code copy-pasted in
> several places (luckily running on x86 computers).

There is no problem with endianness in that code. Perhaps
you meant something more involving than that?

Lev Walkin

More information about the erlang-questions mailing list