Skip to content

Commit

Permalink
common: Add asserts for rotate_*
Browse files Browse the repository at this point in the history
  • Loading branch information
pedantic79 committed Jan 3, 2024
1 parent 078dccb commit 9c4100a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ where
T: Default + Copy,
A: AsMut<[T]>,
{
assert_eq!(a.len(), a[0].as_mut().len(), "not a square matrix");
let len = a.len();
for i in 0..(len / 2) {
for j in i..(len - i - 1) {
Expand All @@ -20,6 +21,7 @@ where
T: Default + Copy,
A: AsMut<[T]>,
{
assert_eq!(a.len(), a[0].as_mut().len(), "not a square matrix");
let len = a.len();
for i in 0..(len / 2) {
for j in i..(len - i - 1) {
Expand All @@ -37,6 +39,7 @@ where
T: Default + Copy,
A: AsMut<[T]>,
{
assert_eq!(a.len(), a[0].as_mut().len(), "not a square matrix");
let len = a.len();

if len % 2 == 1 {
Expand All @@ -59,6 +62,7 @@ where
T: Default + Copy,
A: AsMut<[T]>,
{
assert_eq!(a.len(), a[0].as_mut().len(), "not a square matrix");
for row in a.iter_mut() {
row.as_mut().reverse();
}
Expand Down

0 comments on commit 9c4100a

Please sign in to comment.