Simplify checked_next_power_of_two function

This commit is contained in:
Irfan Hudda 2017-04-29 01:51:54 +05:30
parent 67684a399c
commit ed24829985

View file

@ -2376,12 +2376,7 @@ macro_rules! uint_impl {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn checked_next_power_of_two(self) -> Option<Self> {
let npot = self.one_less_than_next_power_of_two().wrapping_add(1);
if npot >= self {
Some(npot)
} else {
None
}
self.one_less_than_next_power_of_two().checked_add(1)
}
}
}