Boost logo

Boost :

Subject: Re: [boost] [endian] swap_in_place use case
From: Michael Caisse (boost_at_[hidden])
Date: 2010-06-04 14:37:54

vicente.botet wrote:
> Hi,
> I'm looking for a use case where the use of swap_in_place (or whatever is renamed) is not followed/preceded by a copy.


> Can somene help me to identify a real use case on which the swap_in_place can be used to reveive a message, without needing to do any additional copy from the swapped buffer to native data?
> Thanks,
> _____________________
> Vicente Juan Botet Escribá

Hello Vicente -

I hope you are doing well. It was a pleasure to meet you at boostcon.

I think one problem might be the focus on "messaging" as the reason for
endian swapping. Granted, that is a large use case and one that I
suspect most of us use. I also do a fair amount of swapping of
bytes/bits in signal processing work. Typically I have received some
signal via a DMA transfer and now need to operate on it. As much as
possible this is done in-place.

Typical operations include changing the endian to match the processor.
For example, many PCM codecs will result in a little endian audio
signal; however, most of my favorite processors are big endian. The swap
will be in-place.

Another typical operation is time decimation for a Fourier transform
which is basically bit-reversal of the indexes. This is also in-place.

Even my messaging for these small embedded processors is in-place. I
just don't have the memory nor cycles to make copies. A message is
formed in memory. It is "transformed" to the right endian and then the
buffer is sent to a DMA engine.

I could provide dozens of use-cases of in-place endian transforms. Just
start thinking little to no memory and not a lot of processor cycles and
you can come up with a bunch.

Hope this helps a little. The endian library is of great interest to me.
I'm reading all of the email traffic but don't have the time right yet
to jump into the discussion.


Michael Caisse
Object Modeling Designs

Boost list run by bdawes at, gregod at, cpdaniel at, john at