Re:[boost] Re: Re: Re: Using Serialization for binary

In-Reply-To: <20040506033527.A2765313DF@acme.west.net> ramey@rrsd.com (Robert Ramey) wrote (abridged):
Specifically, I'd use a byte oriented scheme where the low 7 bits of each byte contribute to the current number, and the high bit says whether there are more bytes to come.
That's the way it's done in demo_portable_binary_archive included in the current serialization package.
Yes. Demo_portable_binary_archive stores a length byte followed by the bytes needed. I specifically wanted to suggest an alternative to that. Using a bit from each byte means that small integers take half as much space as with your format. Some numbers of bytes: Integer Length Byte High Bit 0 2 1 10 2 1 100 2 1 1000 3 2 10000 3 2 100000 4 3 In practice most integers are small. Eg most archive version numbers will be below 100. -- Dave Harris, Nottingham, UK
participants (1)
-
brangdon@cix.compulink.co.uk