-
Notifications
You must be signed in to change notification settings - Fork 0
Re-write the CRC functionality in Rust #123
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
Conversation
694a1c5 to
ae58af6
Compare
john-michaelburke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM awesome removal of unsafe!
pcrumley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🦀
Looks great. just some minor questions.
swiftnav/src/edc.rs
Outdated
| #[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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