Added etl::ibitset::span() member functions to return a span of the underlying binary data.
Moved image resources
BIN
etl-patreon.png
|
Before Width: | Height: | Size: 36 KiB |
BIN
etl-social.png
|
Before Width: | Height: | Size: 47 KiB |
BIN
favicon.ico
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
@ -50,6 +50,7 @@ SOFTWARE.
|
||||
#include "char_traits.h"
|
||||
#include "static_assert.h"
|
||||
#include "error_handler.h"
|
||||
#include "span.h"
|
||||
|
||||
#include "private/minmax_push.h"
|
||||
|
||||
@ -132,6 +133,9 @@ namespace etl
|
||||
|
||||
static const size_t BITS_PER_ELEMENT = etl::integral_limits<element_t>::bits;
|
||||
|
||||
typedef etl::span<element_t> span_type;
|
||||
typedef etl::span<const element_t> const_span_type;
|
||||
|
||||
enum
|
||||
{
|
||||
npos = etl::integral_limits<size_t>::max
|
||||
@ -749,6 +753,24 @@ namespace etl
|
||||
etl::swap_ranges(pdata, pdata + SIZE, other.pdata);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// span
|
||||
/// Returns a span of the underlying data.
|
||||
//*************************************************************************
|
||||
span_type span()
|
||||
{
|
||||
return span_type(pdata, pdata + SIZE);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
/// span
|
||||
/// Returns a const span of the underlying data.
|
||||
//*************************************************************************
|
||||
const_span_type span() const
|
||||
{
|
||||
return const_span_type(pdata, pdata + SIZE);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -38,7 +38,7 @@ SOFTWARE.
|
||||
///\ingroup utilities
|
||||
|
||||
#define ETL_VERSION_MAJOR 18
|
||||
#define ETL_VERSION_MINOR 10
|
||||
#define ETL_VERSION_MINOR 11
|
||||
#define ETL_VERSION_PATCH 0
|
||||
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Embedded Template Library",
|
||||
"version": "18.10.0",
|
||||
"version": "18.11.0",
|
||||
"authors": {
|
||||
"name": "John Wellbelove",
|
||||
"email": "john.wellbelove@etlcpp.com"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name=Embedded Template Library
|
||||
version=18.10.0
|
||||
version=18.11.0
|
||||
author= John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
|
||||
license=MIT
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
===============================================================================
|
||||
18.11.0
|
||||
Added etl::ibitset::span() member function to return a span of the underlying binary data.
|
||||
|
||||
===============================================================================
|
||||
18.10.0
|
||||
Fixed pointer vector move operators.
|
||||
|
||||
@ -1012,7 +1012,6 @@ namespace
|
||||
CHECK_EQUAL(4U, data.find_next(true, 1));
|
||||
}
|
||||
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_swap)
|
||||
{
|
||||
@ -1027,5 +1026,37 @@ namespace
|
||||
CHECK(data1 == compare2);
|
||||
CHECK(data2 == compare1);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_span)
|
||||
{
|
||||
using span_t = etl::ibitset::span_type;
|
||||
|
||||
etl::bitset<32> b(0x12345678);
|
||||
|
||||
span_t s = b.span();
|
||||
CHECK_EQUAL(0x78, s[0]);
|
||||
CHECK_EQUAL(0x56, s[1]);
|
||||
CHECK_EQUAL(0x34, s[2]);
|
||||
CHECK_EQUAL(0x12, s[3]);
|
||||
|
||||
s[2] = 0x9A;
|
||||
uint32_t value = b.value<uint32_t>();
|
||||
CHECK_EQUAL(0x129A5678, value);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_const_span)
|
||||
{
|
||||
using span_t = etl::ibitset::const_span_type;
|
||||
|
||||
const etl::bitset<32> b(0x12345678);
|
||||
|
||||
span_t s = b.span();
|
||||
CHECK_EQUAL(0x78, s[0]);
|
||||
CHECK_EQUAL(0x56, s[1]);
|
||||
CHECK_EQUAL(0x34, s[2]);
|
||||
CHECK_EQUAL(0x12, s[3]);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -1671,6 +1671,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\.circleci\config.yml" />
|
||||
<None Include="..\..\.github\workflows\main.yml" />
|
||||
<None Include="..\..\etl.pspimage" />
|
||||
<None Include="..\..\etl.xar" />
|
||||
<None Include="..\..\include\etl\generators\generate.bat" />
|
||||
|
||||
@ -76,6 +76,9 @@
|
||||
<Filter Include="Resource Files\CI\CircleCI">
|
||||
<UniqueIdentifier>{0d5824b1-3ef9-43e0-b2d5-15d6246b843e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files\CI\Github">
|
||||
<UniqueIdentifier>{c25471f3-451a-4279-925d-cbdcec912ef8}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\etl\enum_type.h">
|
||||
@ -1438,6 +1441,9 @@
|
||||
<None Include="..\..\.circleci\config.yml">
|
||||
<Filter>Resource Files\CI\CircleCI</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\main.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\include\etl\file_error_numbers.txt">
|
||||
|
||||