evio  5.2
 All Data Structures Files Functions Variables Typedefs Macros Groups
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

void 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

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

Referenced by swap_int16_t().

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

Referenced by evCreateFirstEventBlock(), evPrintBuffer(), evRead(), evReadNoCopy(), evReadRandom(), and swap_int32_t().

#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) )

Referenced by swap_int64_t().

Function Documentation

void 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.

Referenced by evRead(), evReadNoCopy(), and evReadRandom().

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.

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.

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.