Skip to content

use FPC LEtoN/BEtoN intrinsics for wire-to-native reads#122

Merged
Xor-el merged 1 commit into
masterfrom
refactor/binprim-fpc-endian-intrinsics
Jun 30, 2026
Merged

use FPC LEtoN/BEtoN intrinsics for wire-to-native reads#122
Xor-el merged 1 commit into
masterfrom
refactor/binprim-fpc-endian-intrinsics

Conversation

@Xor-el

@Xor-el Xor-el commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Replace the hand-rolled {$IFDEF CRYPTOLIB_LITTLE_ENDIAN} branches in the six private read-side helpers with FPC's dedicated, self-endian-aware RTL intrinsics:

LeToNativeUInt16/32/64 -> LEtoN
BeToNativeUInt16/32/64 -> BEtoN

The intrinsic is used on FPC; Delphi keeps the existing fallback verbatim via {$ELSE}. Generated little-endian code is unchanged (LEtoN/BEtoN are the identity on LE hosts, a bswap on BE) -- this is an idiomatic/clarity change that drops these functions' reliance on the CRYPTOLIB_LITTLE_ENDIAN define and defers the endianness decision to the RTL. All Read* overloads route through these helpers, so the whole read path is covered transitively.

Replace the hand-rolled {$IFDEF CRYPTOLIB_LITTLE_ENDIAN} branches in the six private read-side helpers with FPC's dedicated, self-endian-aware RTL intrinsics:

  LeToNativeUInt16/32/64 -> LEtoN
  BeToNativeUInt16/32/64 -> BEtoN

The intrinsic is used on FPC; Delphi keeps the existing fallback verbatim via {$ELSE}. Generated little-endian code is unchanged (LEtoN/BEtoN are the identity on LE hosts, a bswap on BE) -- this is an idiomatic/clarity change that drops these functions' reliance on the CRYPTOLIB_LITTLE_ENDIAN define and defers the endianness decision to the RTL. All Read* overloads route through these helpers, so the whole read path is covered transitively.
@Xor-el Xor-el merged commit a5a133a into master Jun 30, 2026
36 checks passed
@Xor-el Xor-el deleted the refactor/binprim-fpc-endian-intrinsics branch June 30, 2026 08:55
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.

1 participant