From b4f9bcc86313b73968fa42ee79ba329a697fbc5c Mon Sep 17 00:00:00 2001 From: Marcus Holland-Moritz Date: Sat, 10 Feb 2024 17:04:32 +0100 Subject: [PATCH] chore(ricepp): fixes for windows/clang build --- ricepp/include/ricepp/codec.h | 2 +- ricepp/include/ricepp/detail/decode.h | 3 ++- ricepp/include/ricepp/detail/encode.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ricepp/include/ricepp/codec.h b/ricepp/include/ricepp/codec.h index 90b8d3ac..5105b8cc 100644 --- a/ricepp/include/ricepp/codec.h +++ b/ricepp/include/ricepp/codec.h @@ -130,7 +130,7 @@ class codec final { [[nodiscard]] size_t worst_case_bit_count(size_t pixel_count) const noexcept { static constexpr size_t const kFsBits{ - std::countr_zero(pixel_traits::kBitCount)}; + static_cast(std::countr_zero(pixel_traits::kBitCount))}; assert(pixel_count % kComponentStreamCount == 0); pixel_count /= kComponentStreamCount; size_t num = pixel_traits::kBitCount; // initial value diff --git a/ricepp/include/ricepp/detail/decode.h b/ricepp/include/ricepp/detail/decode.h index 5225c4e7..33a06d89 100644 --- a/ricepp/include/ricepp/detail/decode.h +++ b/ricepp/include/ricepp/detail/decode.h @@ -40,7 +40,8 @@ void decode_block(V block, BitstreamReader& reader, PixelTraits const& traits, typename PixelTraits::value_type& last_value) { using pixel_value_type = typename PixelTraits::value_type; static constexpr unsigned kPixelBits{PixelTraits::kBitCount}; - static constexpr unsigned kFsBits{std::countr_zero(kPixelBits)}; + static constexpr unsigned kFsBits{ + static_cast(std::countr_zero(kPixelBits))}; static constexpr unsigned kFsMax{kPixelBits - 2}; auto last = last_value; diff --git a/ricepp/include/ricepp/detail/encode.h b/ricepp/include/ricepp/detail/encode.h index 5854fee2..0fde4d85 100644 --- a/ricepp/include/ricepp/detail/encode.h +++ b/ricepp/include/ricepp/detail/encode.h @@ -91,7 +91,8 @@ void encode_block(V block, BitstreamWriter& writer, PixelTraits const& traits, typename PixelTraits::value_type& last_value) { using pixel_value_type = typename PixelTraits::value_type; static constexpr unsigned kPixelBits{PixelTraits::kBitCount}; - static constexpr unsigned kFsBits{std::countr_zero(kPixelBits)}; + static constexpr unsigned kFsBits{ + static_cast(std::countr_zero(kPixelBits))}; static constexpr unsigned kFsMax{kPixelBits - 2}; static constexpr pixel_value_type kPixelMsb{static_cast(1) << (kPixelBits - 1)};