evio  5.3
All Data Structures Files Functions Variables Typedefs Macros Modules
swap routines

These routines handle swapping the endianness (little <-> big) of evio data. More...

Macros

#define EVIO_SWAP64(x)
 
#define EVIO_SWAP32(x)
 
#define EVIO_SWAP16(x)
 

Functions

int evioswap (uint32_t *buf, int tolocal, uint32_t *dest)
 Routine to swap the endianness of an evio event (bank). More...
 
uint32_tswap_int32_t (uint32_t *data, unsigned int length, uint32_t *dest)
 This routine swaps a buffer of 32 bit integers. More...
 
uint64_tswap_int64_t (uint64_t *data, unsigned int length, uint64_t *dest)
 This routine swaps a buffer of 64 bit integers. More...
 
uint16_tswap_int16_t (uint16_t *data, unsigned int length, uint16_t *dest)
 This routine swaps a buffer of 16 bit integers. More...
 

Detailed Description

These routines handle swapping the endianness (little <-> big) of evio data.

Macro Definition Documentation

◆ EVIO_SWAP16

#define EVIO_SWAP16 (   x)
Value:
( (((x) >> 8) & 0x00FF) | \
(((x) << 8) & 0xFF00) )

◆ EVIO_SWAP32

#define EVIO_SWAP32 (   x)
Value:
( (((x) >> 24) & 0x000000FF) | \
(((x) >> 8) & 0x0000FF00) | \
(((x) << 8) & 0x00FF0000) | \
(((x) << 24) & 0xFF000000) )

◆ EVIO_SWAP64

#define EVIO_SWAP64 (   x)
Value:
( (((x) >> 56) & 0x00000000000000FFL) | \
(((x) >> 40) & 0x000000000000FF00L) | \
(((x) >> 24) & 0x0000000000FF0000L) | \
(((x) >> 8) & 0x00000000FF000000L) | \
(((x) << 8) & 0x000000FF00000000L) | \
(((x) << 24) & 0x0000FF0000000000L) | \
(((x) << 40) & 0x00FF000000000000L) | \
(((x) << 56) & 0xFF00000000000000L) )

Function Documentation

◆ evioswap()

int evioswap ( uint32_t buf,
int  tolocal,
uint32_t dest 
)

Routine to swap the endianness of an evio event (bank).

Parameters
bufbuffer of evio event data to be swapped
tolocalif 0 buf contains data of same endian as local host, else buf has data of opposite endian
destbuffer to place swapped data into. If this is NULL, then dest = buf.
Returns
S_SUCCESS if successful
S_EVFILE_BADFILE format error in array of composite type
S_EVFILE_BADHEADER inconsistent header data (bad length)

◆ swap_int16_t()

uint16_t* swap_int16_t ( uint16_t data,
unsigned int  length,
uint16_t dest 
)

This routine swaps a buffer of 16 bit integers.

Parameters
datapointer to data to be swapped
lengthnumber of 16 bit ints to be swapped
destpointer to where swapped data is to be copied to. If NULL, the data is swapped in place.
Returns
pointer to beginning of swapped data

References EVIO_SWAP16.

◆ swap_int32_t()

uint32_t* swap_int32_t ( uint32_t data,
unsigned int  length,
uint32_t dest 
)

This routine swaps a buffer of 32 bit integers.

Parameters
datapointer to data to be swapped
lengthnumber of 32 bit ints to be swapped
destpointer to where swapped data is to be copied to. If NULL, the data is swapped in place.
Returns
pointer to beginning of swapped data

References EVIO_SWAP32.

◆ swap_int64_t()

uint64_t* swap_int64_t ( uint64_t data,
unsigned int  length,
uint64_t dest 
)

This routine swaps a buffer of 64 bit integers.

Parameters
datapointer to data to be swapped
lengthnumber of 64 bit ints to be swapped
destpointer to where swapped data is to be copied to. If NULL, the data is swapped in place.
Returns
pointer to beginning of swapped data

References EVIO_SWAP64.