add `block_size` and `log_block_size` methods to `Address`

pull/3/head
Szymon Walter 2018-03-20 10:16:30 +01:00
parent e6ebd09b3e
commit b55633205e
2 changed files with 9 additions and 0 deletions

View File

@ -59,6 +59,14 @@ impl<S: Size> Address<S> {
.and_then(|block| block.checked_add(self.offset))
}
pub const fn block_size(&self) -> usize {
S::SIZE
}
pub const fn log_block_size(&self) -> u32 {
S::LOG_SIZE
}
pub fn block(&self) -> usize {
self.block
}

View File

@ -2,6 +2,7 @@
#![feature(specialization)]
#![feature(swap_with_slice)]
#![feature(macro_lifetime_matcher)]
#![feature(const_fn)]
#![cfg_attr(all(not(test), feature = "no_std"), no_std)]
#[macro_use]