Skip to content

fix: add missing pa_ variable in sw32_ bswap fallback#725

Merged
FrancescAlted merged 1 commit intoBlosc:mainfrom
Scottcjn:fix/bswap-missing-pa-variable
Mar 27, 2026
Merged

fix: add missing pa_ variable in sw32_ bswap fallback#725
FrancescAlted merged 1 commit intoBlosc:mainfrom
Scottcjn:fix/bswap-missing-pa-variable

Conversation

@Scottcjn
Copy link
Copy Markdown
Contributor

Summary

Fixes #724 — the non-builtin byte-swap fallback in sw32_() uses pa_[0..3] but never declares pa_. This breaks compilation on platforms without __builtin_bswap32 or _byteswap_ulong.

Fix

One line added:

const uint8_t *pa_ = (const uint8_t *)pa;

This matches the pattern used in endian_handler() at line 57 of the same file, where pa_ is properly declared before use.

Testing

  • Verified the fix matches the existing pattern in endian_handler()
  • The #else branch is only reached on compilers without GCC builtins or MSVC intrinsics
  • Minimal change — one line, zero risk to existing platforms

The non-builtin byte-swap fallback in sw32_() uses pa_[0..3] but
never declares pa_. This breaks compilation on platforms without
__builtin_bswap32 or _byteswap_ulong (e.g. exotic C compilers).

Add `const uint8_t *pa_ = (const uint8_t *)pa;` to match the
pattern used in endian_handler() at line 57.

Fixes Blosc#724.
@FrancescAlted FrancescAlted merged commit 41b47d9 into Blosc:main Mar 27, 2026
18 checks passed
@FrancescAlted
Copy link
Copy Markdown
Member

Thanks @Scottcjn !

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.

Missing variable in bswap non-builtin fallback

2 participants