Commit d0d79bd1 for libheif

commit d0d79bd1774e81c34a9525848be93e7686d0fe44
Author: Dirk Farin <dirk.farin@gmail.com>
Date:   Mon Oct 5 01:26:44 2026 +0200

    Avoid a dead store in the byte order selection of check_sample_value_ranges()

    The function computed one flag for the big-endian and one for the
    little-endian interleaved formats and selected between them with
    std::endian::native == std::endian::little. That condition is a
    compile-time constant, so on a little-endian machine the second flag was
    never read, which clang-tidy reports as an error
    (clang-analyzer-deadcode.DeadStores).

    Set a single variable in an if/else on the chroma format instead. No
    change in behaviour.

diff --git a/libheif/image/pixelimage.cc b/libheif/image/pixelimage.cc
index acdf99d2..9ad4c7ce 100644
--- a/libheif/image/pixelimage.cc
+++ b/libheif/image/pixelimage.cc
@@ -1102,13 +1102,18 @@ static bool plane_has_sample_with_bits(const void* mem, size_t stride, size_t sa

 Error HeifPixelImage::check_sample_value_ranges() const
 {
-  // The interleaved RRGGBB formats store their samples with a fixed byte order.
-  const bool big_endian_samples = (m_chroma == heif_chroma_interleaved_RRGGBB_BE ||
-                                   m_chroma == heif_chroma_interleaved_RRGGBBAA_BE);
-  const bool little_endian_samples = (m_chroma == heif_chroma_interleaved_RRGGBB_LE ||
-                                      m_chroma == heif_chroma_interleaved_RRGGBBAA_LE);
-  const bool swapped_byte_order = (std::endian::native == std::endian::little) ? big_endian_samples
-                                                                               : little_endian_samples;
+  // The interleaved RRGGBB formats store their samples with a fixed byte order, which can
+  // differ from the byte order of the machine.
+  bool swapped_byte_order = false;
+
+  if (m_chroma == heif_chroma_interleaved_RRGGBB_BE ||
+      m_chroma == heif_chroma_interleaved_RRGGBBAA_BE) {
+    swapped_byte_order = (std::endian::native != std::endian::big);
+  }
+  else if (m_chroma == heif_chroma_interleaved_RRGGBB_LE ||
+           m_chroma == heif_chroma_interleaved_RRGGBBAA_LE) {
+    swapped_byte_order = (std::endian::native != std::endian::little);
+  }

   for (const auto& component : m_storage) {
     if (component.m_datatype != heif_component_datatype_unsigned_integer) {