Boost logo

Boost :

Subject: Re: [boost] How do folks test serialization code?
From: John Maddock (john_at_[hidden])
Date: 2013-08-05 11:44:45


>> I've just committed the code so you can try for yourself, but
>> basically rather than storing a sequence of "limbs" (which may vary
>> in size from one platform/compiler to another), it stores a sequence
>> of bytes instead. The bytes are extracted using high level
>> operations (shifts and bitmasks) so there's no issue with endianness
>> etc.
>
> As I said before - this shouldn't be necessary.

Consider a 128-bit integer type, internally this could be:

* Expressed as 8 16-bit integers (intmax_t=32 bits).
* Expressed as 4 32-bit integers (intmax_t=64 bits).
* Expressed as a single 128-bit (native) integer.

How would you serialize from one format to a different one without breaking
it down into "portably small" chunks?

John.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk