GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> PBS / dev > pbs / rhel5-32


Interface   Data Structures   File List   Data Fields   Globals  

BSWP.ih File Reference

Byteswapping, inline versions. More...

#include <PBI/BSWP.ih>


Detailed Description

Byteswapping, inline versions.

Author:
JJRussell - russell@slac.stanford.edu

    CVS $Id: BSWP.ih,v 1.9 2011/03/24 23:05:41 apw Exp $

SYNOPSIS
This provides a generic interface to the inline byte swapping. These routines are inspired by the PPC instructions that perform byte swapping operations.

The PPC provides three sets of instuctions, one that operates on 16 bit values one that operates on 32 bit values and one that operates on 64 bit values. All three sets have five instructions. The first two byte swaps the data as in loads it from memory, while the second one byte swaps the data as it stores it in memory. These instructions come in two flavors, a straight addressing mode and an indexed addressing mode. The final two do the byteswapping as immediate value. This final one is provided only in this sense of completing the complement of operations. Unfortunately there is no instruction to byte swap a value already in a register. All 6 of these instructions are made available as inline functions.

In addition to splitting the routines into 16, 32 and 64 bit versions, the routines can be split along another axis, single and array versions. The array versions are really just convenience routines in that all they do is wrap the single word routines in a loop. Since this is a common thing to do, they are also provided, although only in a callable form (see BSWP.h).

The single word swapping routines have only an inline implementation. This is because these routines are so simple and efficiency is a major design driver, there is no reason to use a callable version.


Generated on Fri Aug 5 18:32:29 2011 by  doxygen 1.5.8