fix: restore endian-aware optimizations for 64-bit BYTEORDER#27
Draft
fix: restore endian-aware optimizations for 64-bit BYTEORDER#27
Conversation
The BYTESWAP optimization and alignment-aware fast paths were removed in commit 2503291 because they only handled 32-bit BYTEORDER values (0x1234, 0x4321), treating 64-bit architectures as "unusual byte order". This restores those optimizations extended for 64-bit byte orders: - BYTESWAP macro now handles 0x12345678 (64-bit LE) and 0x87654321 (64-bit BE) in addition to the 32-bit variants - Direct memory access fast path in MD5Transform for little-endian platforms without alignment requirements - BYTESWAP-based fast paths in MD5Final for writing bits and digest On platforms where U32_ALIGNMENT_REQUIRED is not set and BYTEORDER is known, this avoids the overhead of byte-by-byte s2u/u2s conversions. Fixes #8 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Docker Hub has removed perl:5.8 through perl:5.24 container images, causing CI failures on all branches including main. Replace the container-based approach with shogo82148/actions-setup-perl which builds Perl from source and supports 5.8+. Changes: - Switch linux matrix from Docker containers to actions-setup-perl - Update actions/checkout v2 -> v4 - Update install-with-cpm v1 -> stable (ubuntu job) - Add Perl 5.34, 5.36, 5.38, 5.40 to test matrix - Drop Perl 5.8 (22 years old, minimal practical value) - Add Windows CI job (Strawberry Perl via actions-setup-perl) - Add macOS CI job (system perl, no container) - Limit AUTHOR_TESTING/RELEASE_TESTING to ubuntu job only Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Restores the BYTESWAP optimization and alignment-aware fast paths that were removed in commit 2503291, extended to handle 64-bit BYTEORDER values (0x12345678 for little-endian, 0x87654321 for big-endian).
The previous commit removed these optimizations entirely because they only handled 32-bit BYTEORDER values, causing all 64-bit architectures to fall through to the slow byte-by-byte s2u/u2s conversion path. This fix properly extends the preprocessor conditions to recognize 64-bit byte orders, restoring performance on platforms where U32 alignment is not required.
Fixes #8
Changes
BYTESWAPmacro with 64-bit BYTEORDER support (0x12345678 LE, 0x87654321 BE)MD5Transformfor LE platforms without alignment requirementsBYTESWAP-based fast paths inMD5Finalfor writing bits and digest outputt/files.texpected hash for modifiedMD5.xsTest plan
make test) on x86_64 Linuxt/align.t) continues to pass, verifying unaligned access works correctlyd_u32align=define), the safe s2u/u2s path is used; the BYTESWAP optimization activates on systems whereU32_ALIGNMENT_REQUIREDis not definedGenerated by Kōan /fix
Quality Report
Changes: 2 files changed, 42 insertions(+), 2 deletions(-)
Code scan: clean
Tests: passed (OK)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline