diff --git a/src/builder.rs b/src/builder.rs index 1dca853..31933db 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -21,8 +21,8 @@ struct Counter { impl Counter { fn new() -> Self { Self { - counts1: vec![0; 511], - counts2: vec![vec![0; 511]; 511], + counts1: vec![0; Code::CODE_MAX as usize], + counts2: vec![vec![0; Code::CODE_MAX as usize]; Code::CODE_MAX as usize], } } diff --git a/src/lib.rs b/src/lib.rs index 390a7bc..068f610 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -98,10 +98,9 @@ pub struct Code(u16); impl Code { /// Maximum code value for the in-memory `Code` representation. - pub const CODE_MAX: u16 = 512; - - /// Maximum code value. Code 255 is reserved as the [escape code][`Self::ESCAPE_CODE`]. - pub const MAX_CODE: u8 = 254; + /// + /// When truncated to u8 this is code 255, which is equivalent to [`Self::ESCAPE_CODE`]. + pub const CODE_MAX: u16 = 511; /// Code used to indicate bytes that are not in the symbol table. ///