GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBS / V2-10-10
Constituent: test_parity     Tag: mv2304
CVS $Id
The PARITY facility consists of a collection of routines used to generate the parity of bytes, shorts, ints and arrays of the same. The method is a seriers of divide and conquer XORs. For example, to calculate the overall parity of an array of integers, the integers are all first XOR'ed together, then the remaining two 16 bit halves of the integer are XORed, followed by XOR'ing the remaining to bytes, etc. (Well, not quite, once one gets down to the byte level, another even faster techique is used; see the PARITY routines themselves for details if you are interested.)
Because the routines are both compact and very efficient, they are available, not only in traditional callable form, but also as inline routines.
The test can be run from the command line by typing
$ test_parity