Skip to content

Commit

Permalink
Increase the offset for shorts and mediums by 1
Browse files Browse the repository at this point in the history
I believe both shorts and mediums can encode a one more offset byte.

0b1111_1111 + 1 = 1024
0b11_1111_1111_1111 + 1 = 16384
  • Loading branch information
lingeringwillx authored and actioninja committed Oct 26, 2023
1 parent 70202fa commit e791c22
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/data/control/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub const COPY_LITERAL_MAX: u8 = 3;
pub const SHORT_OFFSET_MIN: u16 = 1;

/// maximum offset distance for a short command
pub const SHORT_OFFSET_MAX: u16 = 1_023;
pub const SHORT_OFFSET_MAX: u16 = 1_024;

/// minimum length for a short command
pub const SHORT_LENGTH_MIN: u8 = 3;
Expand All @@ -64,7 +64,7 @@ pub const SHORT_LENGTH_MAX: u8 = 10;
pub const MEDIUM_OFFSET_MIN: u16 = 1;

/// maximum offset distance for a medium command
pub const MEDIUM_OFFSET_MAX: u16 = 16_383;
pub const MEDIUM_OFFSET_MAX: u16 = 16_384;

/// minimum length for a medium command
pub const MEDIUM_LENGTH_MIN: u8 = 4;
Expand Down Expand Up @@ -115,7 +115,7 @@ pub const LONG_LENGTH_MAX: u16 = 1_028;
/// | Command | Len | Literal | Length | Position | Layout |
/// |---------|-----|--------------|---------------|-----------------|-------------------------------------------|
/// | Short | 2 | (0..=3) +0 | (3..=10) +3 | (1..=1024) +1 | `0PPL-LLBB:PPPP-PPPP` |
/// | Medium | 3 | (0..=3) +0 | (4..=67) +4 | (1..=16383) +1 | `10LL-LLLL:BBPP-PPPP:PPPP-PPPP` |
/// | Medium | 3 | (0..=3) +0 | (4..=67) +4 | (1..=16384) +1 | `10LL-LLLL:BBPP-PPPP:PPPP-PPPP` |
/// | Long | 4 | (0..=3) +0 | (5..=1028) +5 | (1..=131072) +1 | `110P-LLBB:PPPP-PPPP:PPPP-PPPP:LLLL-LLLL` |
/// | Literal | 1 | (4..=112) +4 | 0 | 0 | `111B-BBBB` |
/// | Stop | 1 | (0..=3) +0 | 0 | 0 | `1111-11BB` |
Expand Down

0 comments on commit e791c22

Please sign in to comment.