Skip to content

Conversation

@folkertdev
Copy link
Member

@folkertdev folkertdev commented Feb 25, 2025

Using standard ptr::{read_unaligned, write_unaligned} on an [u8; N] generates the same code. That also means we can just pass the optimal read/write width as a const generic, which is much clearer.

I think we can then also replace the FEATURES const generic with the preferred width, but I'll do that separately later.

Comment on lines 376 to +378
#[cfg(target_arch = "x86_64")]
if crate::cpu_features::is_enabled_avx512() {
helper!(Writer::copy_match_help::<__m512i>);
helper!(Writer::copy_match_help::<64>);
Copy link
Member Author

Choose a reason for hiding this comment

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

given our changes to where the target feature is applied, this will not test a simd read/write any more. But those should be semantically equivalent to an array of the corresponding size.

@codecov
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 88.09524% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
zlib-rs/src/inflate/writer.rs 88.09% 5 Missing ⚠️
Files with missing lines Coverage Δ
zlib-rs/src/inflate/writer.rs 92.02% <88.09%> (+2.85%) ⬆️

... and 2 files with indirect coverage changes

@folkertdev folkertdev requested a review from bjorn3 February 25, 2025 15:04
@folkertdev folkertdev merged commit 225fbd1 into main Feb 25, 2025
20 checks passed
@folkertdev folkertdev deleted the unaligned-reads-writes branch February 25, 2025 15:36
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