Function cai_hamming::decode [−][src]
pub fn decode<T: PrimInt>(word: T, par: &[T], locs: &[T]) -> Option<(T, usize)>
Decode the given N-bit word to the nearest codeword using the given M×N parity-check matrix and 2M×N error location lookup table, correcting up to one bit error.
The word should be in systematic form, with k data bits in the MSB followed by N-k parity bits in the LSB.
On success, return Some((word, err))
, where word
is the decoded N-bit codeword and
err
is the number of corrected errors. Otherwise, return None
if the word was
detected to be unrecoverable.