From afd6ec94da33896b0b6626cf5595c2631c07bcfc Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Wed, 6 Aug 2025 14:14:16 +0200 Subject: [PATCH] fix(fits_categorizer): support `get_unused_lsb_count` for big-endian --- src/writer/categorizer/fits_categorizer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/writer/categorizer/fits_categorizer.cpp b/src/writer/categorizer/fits_categorizer.cpp index 332e2b75..0d52c125 100644 --- a/src/writer/categorizer/fits_categorizer.cpp +++ b/src/writer/categorizer/fits_categorizer.cpp @@ -124,7 +124,10 @@ T fold_left_bit_or(std::span data) { template <> unsigned get_unused_lsb_count(std::span imagedata) { - static constexpr uint64_t const kLsbMask{UINT64_C(0x0100010001000100)}; + static constexpr uint64_t const kLsbMask{std::endian::native == + std::endian::little + ? UINT64_C(0x0100010001000100) + : UINT64_C(0x0001000100010001)}; static constexpr size_t const kAlignment{64}; // for AVX512 uint16_t b16{0};