convert most variable swaps to mem swaps

This commit is contained in:
Henry Schimke
2022-12-19 18:04:43 -06:00
parent eaacf31923
commit 8a0cc78c61
11 changed files with 16 additions and 39 deletions

View File

@@ -124,9 +124,7 @@ fn runEuclideanAlgorithm(
let mut a = a;
let mut b = b;
if a.getDegree() < b.getDegree() {
let temp = a;
a = b;
b = temp;
std::mem::swap(&mut a,&mut b);
}
let mut rLast = a;

View File

@@ -139,9 +139,7 @@ impl ModulusPoly {
let mut smallerCoefficients = &self.coefficients;
let mut largerCoefficients = &other.coefficients;
if smallerCoefficients.len() > largerCoefficients.len() {
let temp = smallerCoefficients;
smallerCoefficients = largerCoefficients;
largerCoefficients = temp;
std::mem::swap(&mut smallerCoefficients, &mut largerCoefficients);
}
let mut sumDiff = vec![0032; largerCoefficients.len()];
let lengthDiff = largerCoefficients.len() - smallerCoefficients.len();