Skip to content

Ensure the SWAR chunks are 64-bit in more cases - #1182

Merged
dtolnay merged 1 commit into
serde-rs:masterfrom
CryZe:chunk-64bit
Aug 23, 2024
Merged

dtolnay merged 1 commit into
serde-rs:masterfrom
CryZe:chunk-64bit

Conversation

@CryZe

@CryZe CryZe commented Aug 23, 2024 •

Copy link
Copy Markdown
Contributor

Various architectures have native support for 64-bit integers, but there are Rust targets for those architectures where the pointer size is intentionally just 32-bit. For SWAR this smaller pointer size would negatively affect those targets, so this PR ensures the chunk size stays 64-bit on those targets.

The same is done in various other crates, such as hashbrown. Though I wish there was some sort of #[cfg(target_integer_width = "64")].

Various architectures have support for 64-bit integers, but there are
Rust targets for those architectures where the pointer size is
intentionally just 32-bit. For SWAR this smaller pointer size would
negatively affect those targets, so this PR ensures the chunk size stays
64-bit on those targets.
@purplesyringa

Copy link
Copy Markdown
Contributor

For context:

  • aarch64 is for target aarch64-unknown-linux-gnu_ilp32
  • x86_64 is for target x86_64-unknown-linux-gnux32

WASM's self-explanatory.

@dtolnay dtolnay left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@dtolnay
dtolnay merged commit fec0376 into serde-rs:master Aug 23, 2024
@CryZe
CryZe deleted the chunk-64bit branch August 23, 2024 16:45
takumi-earth pushed a commit to earthlings-dev/json that referenced this pull request Jan 27, 2026
Ensure the SWAR chunks are 64-bit in more cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants