c_pxswap - Byte swaps a data buffer

SYNTAX

#include "worgen.h"

FUNCTION c_pxswap (buf, nentity, size)

     unsigned char          *buf;
     long                   *nentity;
     long                   *size;

PARAMETERS

buf (input/output, length(nentity))

The data buffer which is to be byte swapped. The parameter nentity specifies the number of entities in the data buffer, and parameter size specifies the size of each entity.

nentity (input, integer)

The number of entities to be byte swapped in the buffer.

size (input integer)

The number of bytes per entity. Parameter size is required to be an even value.

DESCRIPTION

The c_pxswap() call is used to byte swap values within a data buffer. The byte swapping algorithm for any entity which occupies 2N bytes is: byte 1 is swapped with byte 2N, byte 2 is swapped with byte 2N-1, byte 3 is swapped with byte 2N-2, and so on, ending with bytes N and N+1.

RETURN VALUE

c_pxswap() returns

     E_SUCC -->  successful completion
     E_FAIL -->  odd number of bytes per entity specified