summaryrefslogtreecommitdiff
path: root/src/dynamic-array.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-10-09 07:50:24 -0400
committerJonathan Bradley <jcb@pikum.xyz>2023-10-09 07:50:24 -0400
commitdcd05e45538a04b7b0d9ae0ff8cc01272a48fd33 (patch)
treeb56b885e3473008e40af197770a5b7e1b67d90aa /src/dynamic-array.hpp
parent791c153aabd579f518a9b00613459cba13734797 (diff)
more memory works
Diffstat (limited to 'src/dynamic-array.hpp')
-rw-r--r--src/dynamic-array.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dynamic-array.hpp b/src/dynamic-array.hpp
index 284ddcc..343f6c1 100644
--- a/src/dynamic-array.hpp
+++ b/src/dynamic-array.hpp
@@ -147,13 +147,13 @@ template <typename T> inline void DynArray<T>::Remove(std::size_t index) {
assert(this->elementCount == 0 && "Invalid DynArray<T>::Remove() - Contains no elements");
assert(index >= this->elementCount && "Invalid DynArray<T>::Remove() - Out of bounds");
uint64_t moveCount = (this->elementCount - index - 1);
- auto *tmp = Pke_New(this->elementSize * moveCount);
+ auto *tmp = Pke_New(sizeof(T) * moveCount);
if IS_DESTRUCTIBLE(T) {
reinterpret_cast<T>(this->ptr + (index * sizeof(T))).~T();
}
- memcpy(tmp, this->ptr + (this->elementSize * (index + 1)), this->elementSize * moveCount);
- memcpy(this->ptr + (this->elementSize * index), tmp, this->elementSize * moveCount);
- Pke_Delete<T>(tmp, moveCount * this->elementSize);
+ memcpy(tmp, this->ptr + (sizeof(T) * (index + 1)), sizeof(T) * moveCount);
+ memcpy(this->ptr + (sizeof(T) * index), tmp, sizeof(T) * moveCount);
+ Pke_Delete(tmp, moveCount * sizeof(T));
this->elementCount -= 1;
}