提交 3ff84fc5 编写于 作者: J Jorge Aparicio

impl {i,u}{8,16,32,64,size}

上级 8afcaabe
......@@ -46,6 +46,7 @@
use std::intrinsics;
use std::marker;
use std::mem;
#[cfg(stage0)]
use std::num::{Int, UnsignedInt};
use std::ptr;
use std::rc::Rc;
......
......@@ -23,7 +23,7 @@
use core::marker::PhantomData;
use core::ops::{Deref, DerefMut, Index, IndexMut};
use core::ptr::Unique;
use core::{slice, mem, ptr, cmp, num, raw};
use core::{slice, mem, ptr, cmp, raw};
use alloc::heap::{self, EMPTY};
use borrow::Borrow;
......@@ -105,7 +105,10 @@ struct MutNodeSlice<'a, K: 'a, V: 'a> {
/// Fails if `target_alignment` is not a power of two.
#[inline]
fn round_up_to_next(unrounded: usize, target_alignment: usize) -> usize {
assert!(num::UnsignedInt::is_power_of_two(target_alignment));
#[cfg(stage0)]
use core::num::UnsignedInt;
assert!(target_alignment.is_power_of_two());
(unrounded + target_alignment - 1) & !(target_alignment - 1)
}
......
......@@ -59,6 +59,7 @@
use core::iter::{repeat, FromIterator, IntoIterator};
use core::marker::PhantomData;
use core::mem;
#[cfg(stage0)]
use core::num::{Int, UnsignedInt};
use core::ops::{Index, IndexMut, Deref, Add};
use core::ops;
......
......@@ -25,6 +25,7 @@
use core::fmt;
use core::iter::{self, repeat, FromIterator, IntoIterator, RandomAccessIterator};
use core::mem;
#[cfg(stage0)]
use core::num::{Int, UnsignedInt};
use core::num::wrapping::WrappingOps;
use core::ops::{Index, IndexMut};
......
此差异已折叠。
......@@ -123,7 +123,7 @@ pub fn new(items: &'a mut [Weighted<T>]) -> WeightedChoice<'a, T> {
// strictly speaking, this is subsumed by the total weight == 0 case
assert!(!items.is_empty(), "WeightedChoice::new called with no items");
let mut running_total = 0;
let mut running_total = 0_usize;
// we convert the list from individual weights to cumulative
// weights so we can binary search. This *could* drop elements
......
......@@ -23,6 +23,7 @@
use iter::{self, Iterator, ExactSizeIterator, IntoIterator, IteratorExt, FromIterator, Extend, Map};
use marker::Sized;
use mem::{self, replace};
#[cfg(stage0)]
use num::{Int, UnsignedInt};
use ops::{Deref, FnMut, Index, IndexMut};
use option::Option::{self, Some, None};
......
......@@ -19,6 +19,7 @@
use marker::{Copy, Send, Sync, Sized, self};
use mem::{min_align_of, size_of};
use mem;
#[cfg(stage0)]
use num::{Int, UnsignedInt};
use num::wrapping::{OverflowingOps, WrappingOps};
use ops::{Deref, DerefMut, Drop};
......
......@@ -23,7 +23,10 @@
use clone::Clone;
use cmp::{PartialOrd, PartialEq};
#[cfg(stage0)]
pub use core::num::{Int, SignedInt, UnsignedInt};
#[cfg(not(stage0))]
pub use core::num::{Int, SignedInt};
pub use core::num::{cast, FromPrimitive, NumCast, ToPrimitive};
pub use core::num::{from_int, from_i8, from_i16, from_i32, from_i64};
pub use core::num::{from_uint, from_u8, from_u16, from_u32, from_u64};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册