ps_ecc/reed_solomon/methods/compute_errors.rs
1use crate::{Polynomial, RSComputeErrorsError, ReedSolomon};
2
3impl ReedSolomon {
4 /// Computes errors in a received codeword.
5 /// # Parameters
6 /// - `length`: full length of the codeword, including parity bytes
7 /// - `syndromes`: syndrome polynomial
8 /// # Errors
9 /// - [`RSComputeErrorsError::GFError`] if an arithmetic operation fails
10 /// - [`RSComputeErrorsError::EuclideanError`] if the Euclidean algorithm fails
11 /// - [`RSComputeErrorsError::TooManyErrors`] if the input is unrecoverable
12 /// - [`RSComputeErrorsError::ZeroErrorLocatorDerivative`] if the error locator derivative evaluates to zero
13 #[inline]
14 pub fn compute_errors(
15 &self,
16 length: u8,
17 syndromes: &Polynomial,
18 ) -> Result<Option<Polynomial>, RSComputeErrorsError> {
19 Self::compute_errors_detached(self.parity(), length, syndromes)
20 }
21}