Skip to content

Commit

Permalink
chore(matrix): use simpler expression
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Aug 4, 2024
1 parent 01abbab commit 1b77124
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,9 @@ impl<C> Matrix<C> {
// Otherwise, calculate the new position using the formula (n * x) % mn1.
// This will ensure we visit all positions in a way that eventually visits
// and transposes every element, without exceeding the matrix's bounds.
x = if x == mn1 { mn1 } else { (n * x) % mn1 };
if x != mn1 {
x = (n * x) % mn1;
}
self.data.swap(x, s);
visited[x / 8] |= 1 << (x % 8);

Expand Down

0 comments on commit 1b77124

Please sign in to comment.