Align: add bytes_usize and bits_usize
This commit is contained in:
@@ -742,11 +742,21 @@ impl Align {
|
||||
1 << self.pow2
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn bytes_usize(self) -> usize {
|
||||
self.bytes().try_into().unwrap()
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn bits(self) -> u64 {
|
||||
self.bytes() * 8
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn bits_usize(self) -> usize {
|
||||
self.bits().try_into().unwrap()
|
||||
}
|
||||
|
||||
/// Computes the best alignment possible for the given offset
|
||||
/// (the largest power of two that the offset is a multiple of).
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user