eviofmtswap.c File Reference

#include <stdio.h>
#include "evio.h"

Defines

#define MIN(a, b)   ( (a) < (b) ? (a) : (b) )

Functions

int eviofmtswap (uint32_t *iarr, int nwrd, unsigned char *ifmt, int nfmt, int tolocal)
 This function converts (swaps) an array of EVIO composite type data between IEEE (big endian) and DECS (little endian) in place.

Define Documentation

#define MIN ( a,
 )     ( (a) < (b) ? (a) : (b) )

Function Documentation

int eviofmtswap ( uint32_t iarr,
int  nwrd,
unsigned char *  ifmt,
int  nfmt,
int  tolocal 
)

This function converts (swaps) an array of EVIO composite type data between IEEE (big endian) and DECS (little endian) in place.

This data does NOT include the composite type's beginning tagsegment and the format string it contains. It also does NOT include the data's bank header words.

Converts the data of array (iarr[i], i=0...nwrd-1) using the format code (ifmt[j], j=0...nfmt-1) .

Algorithm description:

Data processed inside while (ib < nwrd) loop, where 'ib' is iarr[] index; loop breaks when 'ib' reaches the number of elements in iarr[]

Parameters:
iarr pointer to data to be swapped
nwrd number of data words (32-bit ints) to be swapped
ifmt unsigned char array holding translated format
nfmt length of unsigned char array, ifmt, in # of chars
tolocal if 0 data is of same endian as local host, else data is of opposite endian
Returns:
0 if success
-1 if nwrd or nfmt arg(s) < 0

References EVIO_SWAP16, EVIO_SWAP32, and EVIO_SWAP64.


Generated on 4 Feb 2014 for evio by  doxygen 1.6.1