Boost logo

Boost Users :

From: Johan Råde (rade_at_[hidden])
Date: 2008-08-28 15:12:18


Robert Ramey wrote:
> Johan Råde wrote:
>
>> 1 is inefficient when moving data between little-endian platforms
>> 2 is inefficient when moving data between big-endian platforms
>> So 3 should be most efficient. Is there an easy way of storing an
>> endianness-flag in an archive?
>
> The version currently in the package does that now for integer types.
>
> Note, you could store floating points as a pair of integers using
> the facilties already in portable binary archive. This would have
> the side benefit of making the archives signifcantly smaller.

>
> Robert Ramey
>

Great.

Then you can handle float and double by just saving and loading the bytes,
and deal with endianness the same way as for integers.

I don't think there is any other scheme
that will make the archive significantly smaller without losing precision.
I believe that in most applications a float/double contains almost 32/64 bits of entropy.

--Johan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net