First commit for ICMP capabilities, added CPU::GetCacheLineSize(), and removed BaseObj from containers.

This commit is contained in:
2025-03-23 03:10:35 -07:00
parent 39bbcd0d56
commit 352b4d612f
12 changed files with 421 additions and 58 deletions

View File

@@ -12,7 +12,7 @@ namespace ehs
/// @tparam T Array data type to use.
/// @tparam N Number data type to use.
template<typename T, typename N = UInt_64>
class Array : public BaseObj
class Array
{
protected:
T* data;
@@ -20,7 +20,7 @@ namespace ehs
public:
/// Frees any data created on the heap.
~Array() override
~Array()
{
delete[] data;
}
@@ -29,7 +29,6 @@ namespace ehs
Array()
: data(nullptr), size(0)
{
AddType("Array");
}
/// Initializes an empty array with the given size.
@@ -37,7 +36,6 @@ namespace ehs
explicit Array(const N size)
: data(new T[size]), size(size)
{
AddType("Array");
}
/// Initializes this array with an initializer list object.
@@ -45,8 +43,6 @@ namespace ehs
Array(std::initializer_list<T> list)
: data(new T[list.size()]), size(list.size())
{
AddType("Array");
N i = 0;
for (auto v = list.begin(); v != list.end(); ++v)
data[i++] = std::move(*v);
@@ -58,14 +54,12 @@ namespace ehs
Array(const T* const data, const N size)
: data(new T[size]), size(size)
{
AddType("Array");
for (N i = 0; i < size; ++i)
this->data[i] = data[i];
}
Array(Array&& array) noexcept
: BaseObj(array), data(array.data), size(array.size)
: data(array.data), size(array.size)
{
array.data = nullptr;
array.size = 0;
@@ -74,7 +68,7 @@ namespace ehs
/// Copies all members from the given array object.
/// @param [in] array The array object to copy from.
Array(const Array& array)
: BaseObj((BaseObj&&)array), data(new T[array.size]), size(array.size)
: data(new T[array.size]), size(array.size)
{
for (N i = 0; i < size; ++i)
data[i] = array.data[i];
@@ -85,8 +79,6 @@ namespace ehs
if (this == &array)
return *this;
BaseObj::operator=((BaseObj&&)array);
delete[] data;
data = array.data;
size = array.size;
@@ -105,8 +97,6 @@ namespace ehs
if (this == &array)
return *this;
BaseObj::operator=(array);
delete[] data;
data = new T[array.size];
for (N i = 0; i < array.size; ++i)