Skip to content

Commit

Permalink
revert 2048 pointer commit; max length is 2045 for first index
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolopanis committed Dec 13, 2024
1 parent 80d4f92 commit 2369707
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/tctm/tm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl SegmentLength {
#[repr(u16)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FirstHeaderPointer {
/// Index of the first header must be less than 2048
/// Index of the first header must be less than 2046
ByteIndex(u16),
/// This packet contains only IDLE data
OnlyIdleData = 0b111_1111_1110,
Expand All @@ -118,7 +118,7 @@ impl FirstHeaderPointer {

pub fn from_u16(value: u16) -> Result<Self, Error> {
match value {
val if val < 2048 => Ok(Self::ByteIndex(val)),
val if val < 2046 => Ok(Self::ByteIndex(val)),
0b111_1111_1110 => Ok(Self::OnlyIdleData),
0b111_1111_1111 => Ok(Self::NoPacketStart),
val => Err(Error::new(
Expand All @@ -134,7 +134,7 @@ impl FirstHeaderPointer {
pub fn validate(&self) -> Result<(), Error> {
match self {
Self::ByteIndex(index) => {
if index < &2048_u16 {
if index < &2046_u16 {
Ok(())
} else {
Err(Error::new(
Expand Down

0 comments on commit 2369707

Please sign in to comment.