Make next_power_of_two generic for unsigned integers
Also rename `next_power_of_two_opt` to `checked_next_power_of_two`.
This commit is contained in:
@@ -104,7 +104,7 @@ use iter::{Iterator, FromIterator, Extendable, range};
|
||||
use iter::{Filter, AdditiveIterator, Map};
|
||||
use iter::{Rev, DoubleEndedIterator, ExactSize};
|
||||
use libc;
|
||||
use num::{Saturating};
|
||||
use num::{Saturating, checked_next_power_of_two};
|
||||
use option::{None, Option, Some};
|
||||
use ptr;
|
||||
use ptr::RawPtr;
|
||||
@@ -2640,7 +2640,7 @@ impl OwnedStr for ~str {
|
||||
|
||||
#[inline]
|
||||
fn reserve_at_least(&mut self, n: uint) {
|
||||
self.reserve(uint::next_power_of_two_opt(n).unwrap_or(n))
|
||||
self.reserve(checked_next_power_of_two(n).unwrap_or(n))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user