Fix span size type (#1363)

* Print test names at test time (#1343)

* Fix span size type

size() returned a signed value while declared (unsigned) size_t.

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
Roland Reichwein 2026-03-25 08:54:18 +01:00 committed by GitHub
parent fa3ac74558
commit 0b5621e809
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1068,7 +1068,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR size_t size() const ETL_NOEXCEPT
{
return (pend - pbegin);
return static_cast<size_t>(pend - pbegin);
}
//*************************************************************************
@ -1076,7 +1076,7 @@ namespace etl
//*************************************************************************
ETL_NODISCARD ETL_CONSTEXPR size_t size_bytes() const ETL_NOEXCEPT
{
return sizeof(element_type) * (pend - pbegin);
return sizeof(element_type) * static_cast<size_t>(pend - pbegin);
}
//*************************************************************************
@ -1262,7 +1262,7 @@ namespace etl
ETL_ASSERT(etl::is_aligned<etl::alignment_of<TNew>::value>(pbegin), ETL_ERROR(span_alignment_exception));
return etl::span<TNew, etl::dynamic_extent>(reinterpret_cast<TNew*>(pbegin),
(pend - pbegin) * sizeof(element_type) / sizeof(TNew));
static_cast<size_t>(pend - pbegin) * sizeof(element_type) / sizeof(TNew));
}
//*************************************************************************