Auto merge of #109 - CryZe:clippy, r=japaric

Fix a few clippy warnings
This commit is contained in:
bors 2016-10-16 10:21:06 -07:00 committed by GitHub
commit c8589a315b
2 changed files with 40 additions and 41 deletions

View File

@ -175,7 +175,8 @@ macro_rules! add {
// correct result in that case. // correct result in that case.
if round_guard_sticky > 0x4 { result += one; } if round_guard_sticky > 0x4 { result += one; }
if round_guard_sticky == 0x4 { result += result & one; } if round_guard_sticky == 0x4 { result += result & one; }
return (<$ty>::from_repr(result.0));
<$ty>::from_repr(result.0)
} }
} }
} }

View File

@ -191,49 +191,47 @@ pub extern "C" fn __udivmoddi4(n: u64, d: u64, rem: Option<&mut u64>) -> u64 {
// 1 <= sr <= u32::bits() - 1 // 1 <= sr <= u32::bits() - 1
q = n << (u64::bits() - sr); q = n << (u64::bits() - sr);
r = n >> sr; r = n >> sr;
} else { } else if d.high() == 0 {
if d.high() == 0 { // K X
// K X // ---
// --- // 0 K
// 0 K if d.low().is_power_of_two() {
if d.low().is_power_of_two() { if let Some(rem) = rem {
if let Some(rem) = rem { *rem = u64::from(n.low() & (d.low() - 1));
*rem = u64::from(n.low() & (d.low() - 1));
}
if d.low() == 1 {
return n;
} else {
let sr = d.low().trailing_zeros();
return n >> sr;
};
} }
sr = 1 + u32::bits() + d.low().leading_zeros() - n.high().leading_zeros(); if d.low() == 1 {
return n;
// 2 <= sr <= u64::bits() - 1 } else {
q = n << (u64::bits() - sr); let sr = d.low().trailing_zeros();
r = n >> sr; return n >> sr;
} else { };
// K X
// ---
// K K
sr = d.high().leading_zeros().wrapping_sub(n.high().leading_zeros());
// D > N
if sr > u32::bits() - 1 {
if let Some(rem) = rem {
*rem = n;
}
return 0;
}
sr += 1;
// 1 <= sr <= u32::bits()
q = n << (u64::bits() - sr);
r = n >> sr;
} }
sr = 1 + u32::bits() + d.low().leading_zeros() - n.high().leading_zeros();
// 2 <= sr <= u64::bits() - 1
q = n << (u64::bits() - sr);
r = n >> sr;
} else {
// K X
// ---
// K K
sr = d.high().leading_zeros().wrapping_sub(n.high().leading_zeros());
// D > N
if sr > u32::bits() - 1 {
if let Some(rem) = rem {
*rem = n;
}
return 0;
}
sr += 1;
// 1 <= sr <= u32::bits()
q = n << (u64::bits() - sr);
r = n >> sr;
} }
// Not a special case // Not a special case