Search code examples
bit-manipulationparityerror-detectionerror-checking

Do we add the parity bit to the front or the back of bit set


Do we add the parity bit to the front or the back of the bit set? A bit that acts as a check on a set of binary values, calculated in such a way that the number of 1s in the set plus the parity bit should always be even (or occasionally, should always be odd).


Solution

  • It doesn't matter as long as you are consistent. If at the end, it can be computed and added 'on the fly' without having to make two passes through the data.

    Parity is an extremely weak method of error detection. There are much better methods. Unless you are constrained to use parity, you should look for other choices that can catch more kinds of errors or even do error correction.