Skip to content

Conversation

@jbangelo
Copy link
Collaborator

@jbangelo jbangelo commented Aug 15, 2025

The first chunk of changes from #122.

This re-implements the CRC calculation function in native Rust

What's been rewritten

  • The crc24q function for computing the CRC-24Q checksum on byte-aligned data (e.g. RTCM messages)

What's been left out

  • The crc24q_bits function 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

@jbangelo jbangelo marked this pull request as ready for review August 15, 2025 17:38
@jbangelo jbangelo requested a review from a team as a code owner August 15, 2025 17:38
Copy link

@john-michaelburke john-michaelburke left a 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!

Copy link

@pcrumley pcrumley left a 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.

#[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)

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.

Copy link
Collaborator Author

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.

@jbangelo jbangelo merged commit 24d5643 into master Aug 20, 2025
6 checks passed
@jbangelo jbangelo deleted the jbangelo/riir-edc branch August 20, 2025 03:20
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.

5 participants