summaryrefslogtreecommitdiff
path: root/src/dynamic-array.hpp
diff options
context:
space:
mode:
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;
}