This commit is contained in:
Henry Schimke
2023-01-05 14:03:37 -06:00
parent f425b89510
commit 0185e80090
7 changed files with 15 additions and 15 deletions

View File

@@ -47,7 +47,7 @@ impl GenericGFPoly {
* or if leading coefficient is 0 and this is not a
* constant polynomial (that is, it is not the monomial "0")
*/
pub fn new(field: GenericGFRef, coefficients: &Vec<i32>) -> Result<Self, Exceptions> {
pub fn new(field: GenericGFRef, coefficients: &[i32]) -> Result<Self, Exceptions> {
if coefficients.is_empty() {
return Err(Exceptions::IllegalArgumentException(Some(
"coefficients.len()".to_owned(),

View File

@@ -76,9 +76,8 @@ impl ReedSolomonDecoder {
if noError {
return Ok(0);
}
let syndrome = match GenericGFPoly::new(self.field, &syndromeCoefficients) {
Ok(res) => res,
Err(_fail) => return Err(Exceptions::ReedSolomonException(None)),
let Ok(syndrome) = GenericGFPoly::new(self.field, &syndromeCoefficients) else {
return Err(Exceptions::ReedSolomonException(None));
};
let sigmaOmega = self.runEuclideanAlgorithm(
&GenericGF::buildMonomial(self.field, twoS as usize, 1),

View File

@@ -38,7 +38,7 @@ impl ReedSolomonEncoder {
pub fn new(field: GenericGFRef) -> Self {
let n = field;
Self {
cachedGenerators: vec![GenericGFPoly::new(n, &vec![1]).unwrap()],
cachedGenerators: vec![GenericGFPoly::new(n, &[1]).unwrap()],
field: n,
}
}