Function byteSwapper

Swap the bytes of every element before handing to next processor. The littleEndian compile-time parameter indicates what endianness the data is in. If it matches the platform's endianness, then nothing is done (no byte swap occurs). Otherwise, a byte swap processor is returned wrapping the io pipe.

auto byteSwapper(bool littleEndian = !IsLittleEndian, Chain) (
  Chain c
)
if (isIopipe!Chain && is(typeof(swapBytes(c.window))));

Note, the width of the elements in the iopipe's window must be 2 or 4 bytes wide, and mutable.

Parameters

NameDescription
littleEndian true if the data arrives in little endian mode, false if in big endian mode.
c Source pipe chain for the byte swapper.

Returns

If endianness of the source matches platform, this returns c, otherwise, it returns a byte swapping iopipe wrapper that performs the byte swaps.