add block_size and log_block_size methods to Address

This commit is contained in:
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)) .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 { pub fn block(&self) -> usize {
self.block self.block
} }

View file

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