Skip to content

Instantly share code, notes, and snippets.

@yaodong
Last active August 29, 2015 14:19
Show Gist options
  • Save yaodong/6e89245105190999daff to your computer and use it in GitHub Desktop.
Save yaodong/6e89245105190999daff to your computer and use it in GitHub Desktop.

From WikiPedia:

A parity bit, or check bit is a bit added to the end of a string of binary code that indicates whether the number of bits in the string with the value one is even or odd. Parity bits are used as the simplest form of error detecting code.

There are two variants of parity bits: even parity bit and odd parity bit.

In the case of even parity, the number of bits whose value is 1 in a given set are counted. If that total is odd, the parity bit value is set to 1, making the total count of 1's in the set an even number. If the count of ones in a given set of bits is already even, the parity bit's value remains 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment