pub fn decode_regular_errors(
residue_xor_const: u128,
data_with_checksum_len: usize,
) -> Option<(Vec<usize>, Vec<u8>)>Expand description
Decode a regular-code BCH error pattern. Inputs:
residue_xor_const: the valuepolymod(hrp_expand(hrp) || data_with_checksum) ⊕ MK_REGULAR_CONST. By the BCH syndrome property, this is congruent to the error polynomialE(x)modulog_regular(x).data_with_checksum_len: the total symbol count ofdata_with_checksum(in the0..=93range for the regular code).
Returns Some((positions, magnitudes)) if the algorithm finds a
consistent error pattern of weight ≤ 4. Each positions[k] is an
index into data_with_checksum (post-HRP-prefix); each
magnitudes[k] is a GF(32) symbol that must be XORed into
data_with_checksum[positions[k]] to repair the codeword. Returns
None if the pattern is uncorrectable.