Skip to content

Commit

Permalink
Change extent to Extent to better match existing code
Browse files Browse the repository at this point in the history
  • Loading branch information
mike919192 committed Feb 15, 2024
1 parent 8bad0ea commit 5767899
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions include/etl/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ namespace etl
template <size_t COUNT>
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, COUNT> first() const ETL_NOEXCEPT
{
//if extent is static, check that original span contains at least COUNT elements
ETL_STATIC_ASSERT((extent != etl::dynamic_extent) ? COUNT <= extent : true, "Original span does not contain COUNT elements");
//if Extent is static, check that original span contains at least COUNT elements
ETL_STATIC_ASSERT((Extent != etl::dynamic_extent) ? COUNT <= Extent : true, "Original span does not contain COUNT elements");

return etl::span<element_type, COUNT>(pbegin, pbegin + COUNT);
}
Expand All @@ -316,8 +316,8 @@ namespace etl
template <size_t COUNT>
ETL_NODISCARD ETL_CONSTEXPR etl::span<element_type, COUNT> last() const ETL_NOEXCEPT
{
//if extent is static, check that original span contains at least COUNT elements
ETL_STATIC_ASSERT((extent != etl::dynamic_extent) ? COUNT <= extent : true, "Original span does not contain COUNT elements");
//if Extent is static, check that original span contains at least COUNT elements
ETL_STATIC_ASSERT((Extent != etl::dynamic_extent) ? COUNT <= Extent : true, "Original span does not contain COUNT elements");

return etl::span<element_type, COUNT>(pbegin + Extent - COUNT, (pbegin + Extent));
}
Expand All @@ -338,11 +338,11 @@ namespace etl
ETL_NODISCARD ETL_CONSTEXPR
etl::span<element_type, COUNT != etl::dynamic_extent ? COUNT : Extent - OFFSET> subspan() const ETL_NOEXCEPT
{
//if extent is static, check that OFFSET is within the original span
ETL_STATIC_ASSERT((extent != etl::dynamic_extent) ? OFFSET <= extent : true, "OFFSET is not within the original span");
//if Extent is static, check that OFFSET is within the original span
ETL_STATIC_ASSERT((Extent != etl::dynamic_extent) ? OFFSET <= Extent : true, "OFFSET is not within the original span");

//if count is also static, check that OFFSET + COUNT is within the original span
ETL_STATIC_ASSERT((extent != etl::dynamic_extent) && (COUNT != etl::dynamic_extent) ? COUNT <= (extent - OFFSET) : true, "OFFSET + COUNT is not within the original span");
ETL_STATIC_ASSERT((Extent != etl::dynamic_extent) && (COUNT != etl::dynamic_extent) ? COUNT <= (Extent - OFFSET) : true, "OFFSET + COUNT is not within the original span");

return (COUNT == etl::dynamic_extent) ? etl::span<element_type, COUNT != etl::dynamic_extent ? COUNT : Extent - OFFSET>(pbegin + OFFSET, (pbegin + Extent))
: etl::span<element_type, COUNT != etl::dynamic_extent ? COUNT : Extent - OFFSET>(pbegin + OFFSET, pbegin + OFFSET + COUNT);
Expand All @@ -354,11 +354,11 @@ namespace etl
template <size_t OFFSET, size_t COUNT>
etl::span<element_type, COUNT != etl::dynamic_extent ? COUNT : Extent - OFFSET> subspan() const
{
//if extent is static, check that OFFSET is within the original span
ETL_STATIC_ASSERT((extent != etl::dynamic_extent) ? OFFSET <= extent : true, "OFFSET is not within the original span");
//if Extent is static, check that OFFSET is within the original span
ETL_STATIC_ASSERT((Extent != etl::dynamic_extent) ? OFFSET <= Extent : true, "OFFSET is not within the original span");

//if count is also static, check that OFFSET + COUNT is within the original span
ETL_STATIC_ASSERT((extent != etl::dynamic_extent) && (COUNT != etl::dynamic_extent) ? COUNT <= (extent - OFFSET) : true, "OFFSET + COUNT is not within the original span");
ETL_STATIC_ASSERT((Extent != etl::dynamic_extent) && (COUNT != etl::dynamic_extent) ? COUNT <= (Extent - OFFSET) : true, "OFFSET + COUNT is not within the original span");

if (COUNT == etl::dynamic_extent)
{
Expand Down

0 comments on commit 5767899

Please sign in to comment.