Lines Matching refs:bytes
21 pub fn new(bytes: usize) -> Result<Self, ByteCountNotAligned> { in new()
23 if bytes % host_page_size == 0 { in new()
24 Ok(Self(bytes)) in new()
26 Err(ByteCountNotAligned(bytes)) in new()
36 pub unsafe fn new_unchecked(bytes: usize) -> Self { in new_unchecked()
38 bytes % host_page_size() == 0, in new_unchecked()
42 Self(bytes) in new_unchecked()
48 pub fn new_rounded_up(bytes: usize) -> Result<Self, ByteCountOutOfBounds> { in new_rounded_up()
51 match bytes.checked_add(page_size - 1) { in new_rounded_up()
61 pub fn new_rounded_up_u64(bytes: u64) -> Result<Self, ByteCountOutOfBounds> { in new_rounded_up_u64()
62 let bytes = bytes in new_rounded_up_u64() localVariable
65 Self::new_rounded_up(bytes) in new_rounded_up_u64()
89 pub fn checked_add(self, bytes: HostAlignedByteCount) -> Result<Self, ByteCountOutOfBounds> { in checked_add()
92 .checked_add(bytes.0) in checked_add()
103 pub fn checked_sub(self, bytes: HostAlignedByteCount) -> Result<Self, ByteCountOutOfBounds> { in checked_sub()
106 .checked_sub(bytes.0) in checked_sub()
113 pub fn saturating_sub(self, bytes: HostAlignedByteCount) -> Self { in saturating_sub()
115 Self(self.0.saturating_sub(bytes.0)) in saturating_sub()