fixed stream type and port number

This commit is contained in:
DJMrTV 2025-01-19 19:00:23 +01:00
commit 746f13fb73

View file

@ -65,20 +65,20 @@ pub struct VirtualPort(u8);
impl VirtualPort{
#[inline]
pub const fn get_stream_type(self) -> u8 {
(self.0 & 0xF0) >> 4
}
#[inline]
pub const fn get_port_number(self) -> u8 {
(self.0 & 0x0F)
}
#[inline]
pub const fn get_port_number(self) -> u8 {
(self.0 & 0xF0) >> 4
}
#[inline]
pub fn stream_type(self, val: u8) -> Self {
let masked_val = val & 0x0F;
let masked_val = val & 0xF0;
assert_eq!(masked_val, val);
Self((self.0 & 0xF0) | masked_val)
Self((self.0 & 0x0F) | masked_val)
}
#[inline]