GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBS / V2-10-14

Constituent: test_bswp     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

test_bswp.c File Reference

Unit test for the BSWP routines. More...


Detailed Description

Unit test for the BSWP routines.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id

The BSWP routines provide to important features.

  1. Efficient byte-swapping by using a single machine instruction where possible
  2. Big/Little endian portability

The first feature was the initial driving design force. However, the importance of the second became clearer the more cross-platform code that was written. In many cases, one knows that the representation of either the input or the output is big or little endian. But, from a coding perspective, one does not know the endianness of the target machine. A good analogy is 'hton', the 'host to network' order routines within an Internet application. Here one knows the endianness of the bytes on the network, but, in portable code, one cannot assume anything about the endianness of the host. BSWP provides the same functionality, swapping only when the endianness of the input or output does not match the host representation.

The nature of the tests is documented in the code and printed during its execution.

The test can be run from the command line by typing

   $ test_bswp

Generated on Wed Feb 14 17:34:26 2007 by  doxygen 1.4.4