mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-15 08:26:04 +08:00
Fix compiler warnings from actual sanitizer use
This commit is contained in:
parent
9a6fd6a3a3
commit
f677a1d492
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user