src/base/condcodes.hh
/**
 * Calculate the parity of a value. 1 is for odd parity and 0 is for even.
 *
 * Parameters:
 *   dest: a value to be tested.
 *
 * Rationale:
 *   findParity simply performs bitwise XOR operations on each "pair" of bits
 *   in the dest parameter; the procedure being that a pair of ones will be
 *   XOR'ed out of the intermediate value.
 *
 *   This process is repeated until one last pair of bits are XOR'ed together.
 *   If the intermediate is still one, then there is exactly one high bit
 *   which does not have a corresponding high bit. Therefore, the value must
 *   have odd parity, and we return 1 accordingly. Otherwise we return 0.
 *
 * @ingroup api_base_utils
 */
Calculate the parity of a value. 1 is for odd parity and 0 is for even.
Parameters:
dest: a value to be tested.

findParity simply performs bitwise XOR operations on each "pair" of bits
in the dest parameter; the procedure being that a pair of ones will be
XOR'ed out of the intermediate value.

This process is repeated until one last pair of bits are XOR'ed together.
If the intermediate is still one, then there is exactly one high bit
which does not have a corresponding high bit. Therefore, the value must
have odd parity, and we return 1 accordingly. Otherwise we return 0.


Calculate the parity of a value . 1 is for odd parity and 0 is for even . Parameters : dest : a value to be tested . findParity simply performs bitwise XOR operations on each " pair " of bits in the dest parameter ; the procedure being that a pair of ones will be XOR ' ed out of the intermediate value . This process is repeated until one last pair of bits are XOR ' ed together . If the intermediate is still one then there is exactly one high bit which does not have a corresponding high bit . Therefore the value must have odd parity and we return 1 accordingly . Otherwise we return 0 .
static inline bool
findParity(int width, uint64_t dest)
{
    dest &= mask(width);
    dest ^= (dest >> 32);
    dest ^= (dest >> 16);
    dest ^= (dest >> 8);
    dest ^= (dest >> 4);
    dest ^= (dest >> 2);
    dest ^= (dest >> 1);
    return dest & 1;
}
static inline bool findParity ( int width , uint64_t dest ) { dest &= mask ( width ) ; dest ^= ( dest >> 32 ) ; dest ^= ( dest >> 16 ) ; dest ^= ( dest >> 8 ) ; dest ^= ( dest >> 4 ) ; dest ^= ( dest >> 2 ) ; dest ^= ( dest >> 1 ) ; return dest & 1 ; }
Calculate the parity of a value.
Calculate the parity of a value .