mirror of
https://github.com/ETLCPP/etl.git
synced 2026-10-28 18:07:10 +08:00
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:
parent
fa3ac74558
commit
0b5621e809
@ -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));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user