Skip to content

Commit cc2430c

Browse files
committed
Fix clippy warnings and simd_neg usage
1 parent 1acc2a5 commit cc2430c

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

crates/core_simd/examples/spectral_norm.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn a(i: usize, j: usize) -> f64 {
88

99
fn mult_av(v: &[f64], out: &mut [f64]) {
1010
assert!(v.len() == out.len());
11-
assert!(v.len() % 2 == 0);
11+
assert!(v.len().is_multiple_of(2));
1212

1313
for (i, out) in out.iter_mut().enumerate() {
1414
let mut sum = f64x2::splat(0.0);
@@ -26,7 +26,7 @@ fn mult_av(v: &[f64], out: &mut [f64]) {
2626

2727
fn mult_atv(v: &[f64], out: &mut [f64]) {
2828
assert!(v.len() == out.len());
29-
assert!(v.len() % 2 == 0);
29+
assert!(v.len().is_multiple_of(2));
3030

3131
for (i, out) in out.iter_mut().enumerate() {
3232
let mut sum = f64x2::splat(0.0);
@@ -48,7 +48,7 @@ fn mult_atav(v: &[f64], out: &mut [f64], tmp: &mut [f64]) {
4848
}
4949

5050
pub fn spectral_norm(n: usize) -> f64 {
51-
assert!(n % 2 == 0, "only even lengths are accepted");
51+
assert!(n.is_multiple_of(2), "only even lengths are accepted");
5252

5353
let mut u = vec![1.0; n];
5454
let mut v = u.clone();

crates/std_float/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub trait StdFloat: Sealed + Sized {
6666
#[inline]
6767
#[must_use = "method returns a new vector and does not mutate the original value"]
6868
fn mul_sub(self, a: Self, b: Self) -> Self {
69-
unsafe { intrinsics::simd_fma(self, a, intrinsics::simd_fneg(b)) }
69+
unsafe { intrinsics::simd_fma(self, a, intrinsics::simd_neg(b)) }
7070
}
7171

7272
/// Produces a vector where every element has the square root value

crates/std_float/tests/fma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(portable_simd)]
22

33
use core_simd::simd::prelude::*;
4-
use crate::StdFloat;
4+
use std_float::StdFloat;
55

66
#[test]
77
fn test_mul_add_basic() {

0 commit comments

Comments
 (0)