[erlang-questions] Decoding integers serialised by Erlang
Mikael Pettersson
mikpelinux@REDACTED
Tue Nov 19 11:07:06 CET 2013
Rabbe Fogelholm writes:
> The ei library has functions for decoding Erlang terms in binary format. One of
> these functions is ei_get_type(const char *buf, const int *index, int *type, int *size).
> The returned value for "type" may be ERL_SMALL_INTEGER_EXT, which indicates that
> the data is an 8-bit item.
>
> My question: Do the 8 bits represent an integer 0..255? Or -128..127?
A quick grep in the otp sources reveal that it's the former, i.e. [0,255].
> And, is the
> representation always the same, or does it depend on the platform that the encoding
> took place on?
There should be no platform dependencies in the encoding, and I don't see any,
apart from the common 'char is 8 bits'.
More information about the erlang-questions
mailing list