[erlang-questions] [erlang-patches] ei patch to handle NEW_FLOAT_EXT

Björn-Egil Dahlberg egil@REDACTED
Fri Jul 11 11:59:38 CEST 2008


Hi Serge,

Thank you for sending a patch and underlining this problem.

Compatibility is a problem, and I am not sure yet if this is the solution.

I will look into the matter. *adding it to my todo list*

Regards,
Björn-Egil
Erlang/OTP

Serge Aleynikov wrote:
> Ever since the emulator support of the compact IEEE 754 double encoding 
> in external binary format was introduced I've been patiently waiting for 
> ei to support this feature.  Finally I gave up and implemented this 
> myself as I recently needed to marshal lots of doubles between Erlang 
> and C++ and size of the binary stream did matter.
> 
> Attached is a patch for R12B-2 that implements this feature.  The only 
> thing I wasn't sure about was whether backward compatibility of 
> ei_{encode,decode}_double() is truly required.  It exists in the 
> emulator, where the new functionality is controlled by 
> term_to_binary(Term, [{minor_version, 1}]), and is essential indeed, but 
> is it really needed for ei?  In order to be properly backward 
> compatible, it would likely require to introduce yet another pair of 
> functions, such as:
> 
>     int ei_encode_double_new(char *buf, int *index, double p)
>     int ei_x_encode_double_new(ei_x_buff* x, const void *p, long len)
> 
> which gets a little messy as there are already a fair amount of ei 
> functions.
> 
> Since the internals of the external binary format are hidden behind the 
> facade of:
> 
>     int ei_encode_double(char *buf, int *index, double p)
>     int ei_decode_double(const char *buf, int *index, double *p)
> 
> Perhaps retaining the compatibility of lower-level implementation is not 
> that crucial?  In the patch the old functionality is controlled by 
> setting USE_OLD_FLOAT_ENCODER macro, but this is left discretionary to 
> the OTP team.
> 
> Regards,
> 
> Serge
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-patches




More information about the erlang-questions mailing list