From 1b771246fc9ee81a9b5d5642266b8a3d430bc75c Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Sun, 4 Aug 2024 17:24:18 +0200 Subject: [PATCH] chore(matrix): use simpler expression --- src/matrix.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/matrix.rs b/src/matrix.rs index 18da4f9e..34cc22a7 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -742,7 +742,9 @@ impl Matrix { // 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);