Repository navigation
ENH: Determine the byte order in ByteSwapper and retire the config macros - #7112
hjmjohnson wants to merge 1 commit into
Conversation
bbb2e18 to
fe1a4c5
Compare
|
Force-push fe1a4c5 -> a8c9864, one real fix: the |
fe1a4c5 to
a8c9864
Compare
[High impact] The PR changes shared byte-order logic used across ITK's binary I/O workflows. Fix the system-libpng build regression before merging. Findings
|
…cros itkConfigure.h exposed the byte order detected at configure time as CMAKE_WORDS_BIGENDIAN and ITK_WORDS_BIGENDIAN, which no project in the downstream forest testbed uses, and a configure-time value is wrong for one architecture of a universal binary. ByteSwapper<T>::SystemIsBigEndian() now takes the byte order from the compiler (std::endian in C++20, otherwise its own macros), the three in-tree users call it, the CMake detection is removed, and both macros remain only without ITK_LEGACY_REMOVE.
a8c9864 to
174c206
Compare
Remove the byte order from the public configuration header:
itk::ByteSwapper<T>::SystemIsBigEndian()now determines it from the compiler (std::endianin C++20, otherwise the compiler's own macros), the three in-tree users call it, the CMake detection is removed, andCMAKE_WORDS_BIGENDIAN/ITK_WORDS_BIGENDIANare defined only withoutITK_LEGACY_REMOVE. Follows #7101.Why
itkConfigure.hpublished two macros that no project outside ITK uses (0 of 309 repositories in the downstream forest testbed, and only vendored ITK copies on GitHub), one of them under a CMake-prefixed name. A byte order detected at configure time also describes the building machine, which is wrong for one architecture of a universal binary or for a cross-compile; the compiler always knows the byte order of the architecture it is compiling for. The two names stay as a deprecation path under!ITK_LEGACY_REMOVE, defined from the compiler macros, and the migration guide names the replacement.Local verification (macOS arm64, Homebrew LLVM 23)
ScalarToRGBPixelFunctor.ConvertedLegacyTest).ITK_LEGACY_REMOVE=ONandITK_FUTURE_LEGACY_REMOVE=ON: Common, IOPNG and ImageFusion build; 62/62 of the same tests pass; the generateditkConfigure.hmentions the two names only inside the legacy block.ByteSwapGoogleTest checksSystemIsBigEndian()against the in-memory byte layout of a 16-bit value.pre-commit run --all-filespasses.__BYTE_ORDER__and takes the_WIN32branch) and a full forest build; CI covers the first.AI assistance
Claude Code (Fable 5.1) drafted the change and the guide entry, ran the local builds and tests, and searched the forest testbed for users of the macros. The author reviewed and is responsible for the change.