add block_size
and log_block_size
methods to Address
This commit is contained in:
parent
e6ebd09b3e
commit
b55633205e
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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]
|
||||||
|
|
Reference in a new issue