Skip to content

Fix CRC endianness detection and add s390x regression#179

Merged
PaulTaykalo merged 9 commits intomasterfrom
fix/crc-big-endian-ci
Apr 14, 2026
Merged

Fix CRC endianness detection and add s390x regression#179
PaulTaykalo merged 9 commits intomasterfrom
fix/crc-big-endian-ci

Conversation

@PaulTaykalo
Copy link
Copy Markdown
Contributor

Summary

  • switch CRC fast-path endianness detection to the existing Crypto/brg_endian.h logic
  • stop relying on the undefined XAD_BYTE_ORDER_BIG_ENDIAN macro
  • add a deterministic CRC regression binary
  • run that regression in GitHub Actions under emulated linux/s390x

Testing

  • added a dedicated CRC Big Endian GitHub Actions workflow for s390x
  • local runtime validation is pending on CI because the emulated container build requires networked package install

@PaulTaykalo PaulTaykalo requested a review from Copilot April 14, 2026 05:41
@PaulTaykalo PaulTaykalo merged commit c0c1a61 into master Apr 14, 2026
6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes CRC fast-path endianness detection by switching to the established Crypto/brg_endian.h byte-order logic, and adds deterministic regression coverage (including an emulated s390x GitHub Actions run) to prevent big-endian regressions.

Changes:

  • Replace CRC endianness detection with PLATFORM_BYTE_ORDER == IS_BIG_ENDIAN from Crypto/brg_endian.h.
  • Add deterministic fast-vs-slow CRC regression checks (XCTest + standalone regression binary).
  • Introduce a GitHub Actions workflow that builds/runs the regression under emulated linux/s390x.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
CRC.m Switches the big-endian conditional compilation to brg_endian.h’s PLATFORM_BYTE_ORDER detection.
XADMasterTests/CRCCalculationTests.m Adds deterministic buffers and assertions to ensure fast CRC matches slow CRC for specific sizes/tails.
Tests/CRCFastRegression.m Adds a standalone deterministic regression executable to compare slow vs fast CRC results.
.github/workflows/crc-big-endian.yml Adds an emulated s390x CI workflow to compile and run the regression binary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4 to +6
push:
branches: [ master ]
# Keep this emulated s390x job scoped to the CRC/endian code it protects.
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The workflow is restricted to the master branch for both push and pull_request, but the repository/PR diff base appears to be main (e.g., diff headers show index main..branch). If the default branch is main, this workflow won’t run for the PRs it’s meant to protect. Consider switching the branch filter to main, including both main and master, or omitting the branches filter and relying on the paths filter alone.

Copilot uses AI. Check for mistakes.
Comment thread Tests/CRCFastRegression.m
Comment on lines +11 to +12
if (slow != fast) {
fprintf(stderr, "%s mismatch: slow=0x%08x fast=0x%08x length=%d\n", label, slow, fast, length);
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

fprintf uses %08x to print uint32_t values (slow/fast). uint32_t is not guaranteed to be an unsigned int on all platforms, so this can trigger warnings or incorrect output on some architectures/toolchains. Consider including <inttypes.h> and using PRIx32 (or casting to an explicitly matching type) for portable formatting.

Copilot uses AI. Check for mistakes.
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.

2 participants