Skip to content

Commit

Permalink
fix(util::Align): replace num::One with iter::Step
Browse files Browse the repository at this point in the history
The `num::One` and `num::Zero` traits were removed on nightly. See the
tracking issue rust-lang/rust#27739
  • Loading branch information
hawkw committed May 25, 2017
1 parent b592ab3 commit 018ccef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@
#![crate_name = "util"]
#![no_std]

#![feature(zero_one)]
#![feature(step_trait)]
// #[cfg(not(test))] extern crate vga;

use core::{fmt, ops, num};
use core::{fmt, ops};
use ops::*;
use num::One;
use core::iter::Step;
// use core::num::One;

pub mod io;

Expand All @@ -29,16 +30,17 @@ impl fmt::Debug for Void {
}
}

pub trait Align: Sized + Copy + One
pub trait Align: Sized + Copy //+ One
+ Add<Output=Self> + Sub<Output=Self>
+ BitAnd<Output=Self> + Not<Output=Self>
+ Step
{
#[inline] fn align_up(&self, to: Self) -> Self {
let align = to - One::one();
let align = to.sub_one();
(*self + align) & !align
}
#[inline] fn align_down(&self, to: Self) -> Self {
*self & !(to - One::one())
*self & !to.sub_one()
}
}

Expand Down

0 comments on commit 018ccef

Please sign in to comment.