Skip to main content
added 105 characters in body
Source Link

The below sudo code will generate the total number of parity bits for a given word of a size (2^n bits):

Integer parityBits = 0;

while (powerOf(2, parityBits) < parityBits + wordLength + 1) {
   parityBits++;
}

Note: I have not tested this solution against words with a length different than (2^n bits)

The below sudo code will generate the total number of parity bits for a given word (2^n bits):

Integer parityBits = 0;

while (powerOf(2, parityBits) < parityBits + wordLength + 1) {
   parityBits++;
}

The below sudo code will generate the total number of parity bits for a given word of a size (2^n bits):

Integer parityBits = 0;

while (powerOf(2, parityBits) < parityBits + wordLength + 1) {
   parityBits++;
}

Note: I have not tested this solution against words with a length different than (2^n bits)

Source Link

The below sudo code will generate the total number of parity bits for a given word (2^n bits):

Integer parityBits = 0;

while (powerOf(2, parityBits) < parityBits + wordLength + 1) {
   parityBits++;
}