Fix: add endian byte-swap for portable --fried import/export#226
Open
Thunder-Blaze wants to merge 2 commits into
Open
Fix: add endian byte-swap for portable --fried import/export#226Thunder-Blaze wants to merge 2 commits into
Thunder-Blaze wants to merge 2 commits into
Conversation
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.
Issue
cmd_export.cpp:34andcmd_import.cpp:79Description
The
--friedflag onstrfry exportandstrfry importenables a fast binary format that embeds the packed event representation directly. The packed format storescreated_at,kind, andexpirationas raw uint64 values in native byte order. This means fried data exported on a little-endian system can't be imported on a big-endian one - strfry currently throws a hard error on non-LE systems.This fix defines the fried wire format as always little-endian and adds
friedSwapEndian()which byte-swaps the three uint64 fields (at offsets 64, 72, 80) between native and LE. Usingif constexpr, the swap is a compile-time no-op on little-endian systems - zero runtime cost for x86/ARM-LE.Testing