use core::ops;
use crate::ByteSize;
macroweave::repeat!(Ty in [u8, u16, u32, u64, usize] {
impl ops::Add<ByteSize<Ty>> for ByteSize<Ty> {
type Output = Self;
#[inline(always)]
fn add(self, rhs: ByteSize<Ty>) -> Self::Output {
ByteSize(self.0 + rhs.0)
}
}
impl ops::AddAssign<ByteSize<Ty>> for ByteSize<Ty> {
#[inline(always)]
fn add_assign(&mut self, rhs: ByteSize<Ty>) {
self.0 += rhs.0;
}
}
impl ops::Sub<ByteSize<Ty>> for ByteSize<Ty> {
type Output = Self;
#[inline(always)]
fn sub(self, rhs: ByteSize<Ty>) -> Self::Output {
ByteSize(self.0 - rhs.0)
}
}
impl ops::SubAssign<ByteSize<Ty>> for ByteSize<Ty> {
#[inline(always)]
fn sub_assign(&mut self, rhs: ByteSize<Ty>) {
self.0 -= rhs.0;
}
}
});