Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change hardcoded table sizes into const-generic params. #49

Merged
merged 2 commits into from
Jan 13, 2025

Conversation

anforowicz
Copy link
Contributor

PTAL?

@kornelski kornelski merged commit df5729d into image-rs:main Jan 13, 2025
10 checks passed
@@ -610,6 +618,20 @@ impl CompressedBlock {
mut output_index: usize,
queued_output: &mut Option<QueuedOutput>,
) -> Result<(CompressedBlockStatus, usize), DecompressionError> {
// `litlen_table_mask` (and `dist_table_mask`) calculation assumes that `LITLEN_TABLE_SIZE`
// (or `DIST_TABLE_SIZE`) is a power of two.
assert!(LITLEN_TABLE_SIZE.count_ones() == 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't make a huge difference, but there's actually a is_power_of_two method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and this could be in const {} to check at compile time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants