Fix compiler warnings from actual sanitizer use

This commit is contained in:
Roland Reichwein 2026-04-30 14:56:37 +02:00
parent 9a6fd6a3a3
commit f677a1d492
2 changed files with 9 additions and 1 deletions

View File

@ -566,6 +566,14 @@ namespace etl
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR14 bool is_valid() const ETL_NOEXCEPT
{
// GCC's UBSan instruments function pointer comparisons, which prevents
// constexpr evaluation. Use implicit bool conversion at compile time
// to avoid the instrumented != comparison while still checking validity.
if (etl::is_constant_evaluated())
{
return static_cast<bool>(invocation.stub);
}
return invocation.stub != ETL_NULLPTR;
}

View File

@ -50,7 +50,7 @@ namespace
for (size_t i = 0UL; i < sizeof(value_type); ++i)
{
uint8_t byte = static_cast<uint8_t>((static_cast<unsigned char>(value) >> (i * 8UL)) & 0xFFU);
uint8_t byte = static_cast<uint8_t>((static_cast<unsigned int>(value) >> (i * 8U)) & 0xFFU);
checksum = etl::rotate_right(checksum) + byte;
}
}