Boost logo

Boost :

Subject: Re: [boost] [boost::endian] Request for comments/interest
From: Terry Golubiewski (tjgolubi_at_[hidden])
Date: 2010-05-30 13:10:21


----- Original Message -----
From: "Tomas Puverle" <Tomas.Puverle_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.devel
To: <boost_at_[hidden]>
Sent: Sunday, May 30, 2010 10:33 AM
Subject: Re: [boost::endian] Request for comments/interest

>> Its somewhat off-topic, and I didn't post the code for this class,
>> because
>> its complicated, but
>>
>> bitfield<big, 3, 6, -21, 9>
>>
>> means four consecutive unsigned integer bit fields with widths of 3, 6,
>> 21,
>> and 9 bits, respectively,
>
> Presumably, based on your explanation, you mean 3 unsigned bit fields and
> one
> signed one.

Yes, that's what I mean't. Sorry.

> One question though - is this supposed to swap the "bitfields" (i.e. is
> this a
> generalized endian bit swapper) or is the intent to have a bitfield which
> then
> gets treated as one "larger" type and gets swapped byte-wise?

This is generalized bit swapper. One need not swap the "larger" type.
The bitfield in implemented internally as a char array, large enough to hold
all the bits.
In the above example 3+6+21+9 = 39 bits = 5 bytes (octets).

>> My point was that I don't think of endianess as being a "swapping"
>> problem,
>> but an "ordering" problem.
>> The bit-endianness of messages makes this clear for me, since swapping
>> doesn't work.
>
> I would be interested in knowing what you'd think about implementing the
> swapping using the user defined type endian swapping facility in my
> library.
> At first sight, it seems like it should be possible.

Let's do this!

terry


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