Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 8552890

Browse files
authored
Merge pull request #371 from tgross35/clippy-fixes
Clippy fixes
2 parents 607d4df + b5a1aaf commit 8552890

File tree

23 files changed

+34
-34
lines changed

23 files changed

+34
-34
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ jobs:
120120
run: ./ci/download-musl.sh
121121
- run: |
122122
cargo clippy --all \
123-
--exclude cb \
124123
--features libm-test/build-musl,libm-test/test-multiprecision \
125124
--all-targets
126125

crates/compiler-builtins-smoke-test/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
55
#![feature(core_intrinsics)]
66
#![allow(internal_features)]
7-
#![allow(dead_code)]
87
#![no_std]
98

9+
#[allow(dead_code)]
10+
#[allow(clippy::all)] // We don't get `libm`'s list of `allow`s, so just ignore Clippy.
1011
#[path = "../../../src/math/mod.rs"]
1112
pub mod libm;

src/math/ceil.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub fn ceil(x: f64) -> f64 {
1616
}
1717

1818
let u: u64 = x.to_bits();
19-
let e: i64 = (u >> 52 & 0x7ff) as i64;
19+
let e: i64 = ((u >> 52) & 0x7ff) as i64;
2020
let y: f64;
2121

2222
if e >= 0x3ff + 52 || x == 0. {

src/math/exp10.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub fn exp10(x: f64) -> f64 {
1212
let (mut y, n) = modf(x);
1313
let u: u64 = n.to_bits();
1414
/* fabs(n) < 16 without raising invalid on nan */
15-
if (u >> 52 & 0x7ff) < 0x3ff + 4 {
15+
if ((u >> 52) & 0x7ff) < 0x3ff + 4 {
1616
if y == 0.0 {
1717
return i!(P10, ((n as isize) + 15) as usize);
1818
}

src/math/exp10f.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn exp10f(x: f32) -> f32 {
1111
let (mut y, n) = modff(x);
1212
let u = n.to_bits();
1313
/* fabsf(n) < 8 without raising invalid on nan */
14-
if (u >> 23 & 0xff) < 0x7f + 3 {
14+
if ((u >> 23) & 0xff) < 0x7f + 3 {
1515
if y == 0.0 {
1616
return i!(P10, ((n as isize) + 7) as usize);
1717
}

src/math/exp2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ pub fn exp2(mut x: f64) -> f64 {
341341

342342
/* Filter out exceptional cases. */
343343
let ui = f64::to_bits(x);
344-
let ix = ui >> 32 & 0x7fffffff;
344+
let ix = (ui >> 32) & 0x7fffffff;
345345
if ix >= 0x408ff000 {
346346
/* |x| >= 1022 or nan */
347347
if ix >= 0x40900000 && ui >> 63 == 0 {

src/math/fma.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
8282
d -= 64;
8383
if d == 0 {
8484
} else if d < 64 {
85-
rlo = rhi << (64 - d) | rlo >> d | ((rlo << (64 - d)) != 0) as u64;
85+
rlo = (rhi << (64 - d)) | (rlo >> d) | ((rlo << (64 - d)) != 0) as u64;
8686
rhi = rhi >> d;
8787
} else {
8888
rlo = 1;
@@ -95,7 +95,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
9595
if d == 0 {
9696
zlo = nz.m;
9797
} else if d < 64 {
98-
zlo = nz.m >> d | ((nz.m << (64 - d)) != 0) as u64;
98+
zlo = (nz.m >> d) | ((nz.m << (64 - d)) != 0) as u64;
9999
} else {
100100
zlo = 1;
101101
}
@@ -127,11 +127,11 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
127127
e += 64;
128128
d = rhi.leading_zeros() as i32 - 1;
129129
/* note: d > 0 */
130-
rhi = rhi << d | rlo >> (64 - d) | ((rlo << d) != 0) as u64;
130+
rhi = (rhi << d) | (rlo >> (64 - d)) | ((rlo << d) != 0) as u64;
131131
} else if rlo != 0 {
132132
d = rlo.leading_zeros() as i32 - 1;
133133
if d < 0 {
134-
rhi = rlo >> 1 | (rlo & 1);
134+
rhi = (rlo >> 1) | (rlo & 1);
135135
} else {
136136
rhi = rlo << d;
137137
}
@@ -165,7 +165,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
165165
/* one bit is lost when scaled, add another top bit to
166166
only round once at conversion if it is inexact */
167167
if (rhi << 53) != 0 {
168-
i = (rhi >> 1 | (rhi & 1) | 1 << 62) as i64;
168+
i = ((rhi >> 1) | (rhi & 1) | (1 << 62)) as i64;
169169
if sign != 0 {
170170
i = -i;
171171
}
@@ -182,7 +182,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
182182
} else {
183183
/* only round once when scaled */
184184
d = 10;
185-
i = ((rhi >> d | ((rhi << (64 - d)) != 0) as u64) << d) as i64;
185+
i = (((rhi >> d) | ((rhi << (64 - d)) != 0) as u64) << d) as i64;
186186
if sign != 0 {
187187
i = -i;
188188
}

src/math/fmod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
pub fn fmod(x: f64, y: f64) -> f64 {
33
let mut uxi = x.to_bits();
44
let mut uyi = y.to_bits();
5-
let mut ex = (uxi >> 52 & 0x7ff) as i64;
6-
let mut ey = (uyi >> 52 & 0x7ff) as i64;
5+
let mut ex = ((uxi >> 52) & 0x7ff) as i64;
6+
let mut ey = ((uyi >> 52) & 0x7ff) as i64;
77
let sx = uxi >> 63;
88
let mut i;
99

src/math/fmodf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use core::f32;
44
pub fn fmodf(x: f32, y: f32) -> f32 {
55
let mut uxi = x.to_bits();
66
let mut uyi = y.to_bits();
7-
let mut ex = (uxi >> 23 & 0xff) as i32;
8-
let mut ey = (uyi >> 23 & 0xff) as i32;
7+
let mut ex = ((uxi >> 23) & 0xff) as i32;
8+
let mut ey = ((uyi >> 23) & 0xff) as i32;
99
let sx = uxi & 0x80000000;
1010
let mut i;
1111

src/math/j1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ pub fn y1(x: f64) -> f64 {
171171
lx = get_low_word(x);
172172

173173
/* y1(nan)=nan, y1(<0)=nan, y1(0)=-inf, y1(inf)=0 */
174-
if (ix << 1 | lx) == 0 {
174+
if (ix << 1) | lx == 0 {
175175
return -1.0 / 0.0;
176176
}
177-
if (ix >> 31) != 0 {
177+
if ix >> 31 != 0 {
178178
return 0.0 / 0.0;
179179
}
180180
if ix >= 0x7ff00000 {

0 commit comments

Comments
 (0)