Skip to content

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

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#89
Xor-el merged 1 commit into
masterfrom
refactor/binprim-fpc-endian-intrinsics

Conversation

@Xor-el

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

Copy link
Copy Markdown
Owner

Replace the hand-rolled {$IFDEF HASHLIB_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 HASHLIB_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 HASHLIB_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 HASHLIB_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 dda6e90 into master Jun 30, 2026
24 checks passed
@Xor-el Xor-el deleted the refactor/binprim-fpc-endian-intrinsics branch June 30, 2026 00:29
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