Re-write the CRC functionality in Rust#123
Merged
Merged
Conversation
694a1c5 to
ae58af6
Compare
john-michaelburke
approved these changes
Aug 19, 2025
john-michaelburke
left a comment
There was a problem hiding this comment.
LGTM awesome removal of unsafe!
JADC362
approved these changes
Aug 19, 2025
pcrumley
approved these changes
Aug 19, 2025
pcrumley
left a comment
There was a problem hiding this comment.
🦀
Looks great. just some minor questions.
| #[must_use] | ||
| pub fn compute_crc24q(buf: &[u8], initial_value: u32) -> u32 { | ||
| unsafe { swiftnav_sys::crc24q(buf.as_ptr(), buf.len() as u32, initial_value) } | ||
| crc24q(buf, initial_value) |
There was a problem hiding this comment.
Do you want to keep the original fn here then we can remove it entirely in next version? I guess i don't really understand the reasoning of renaming the function to a new function AND updating the old function to be an alias of this function.
Collaborator
Author
There was a problem hiding this comment.
I guess there's no real reason to rename this function. The original idea was to closer mimic the C library, but that doesn't make a lot of sense now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The first chunk of changes from #122.
This re-implements the CRC calculation function in native Rust
What's been rewritten
crc24qfunction for computing the CRC-24Q checksum on byte-aligned data (e.g. RTCM messages)What's been left out
crc24q_bitsfunction for computing the CRC-24Q checksum on unaligned data (e.g. GPS CNAV messages)What's been removed
No functionality has been removed in this PR