mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
chore(array): eliminate sign mismatches
This commit is contained in:
parent
e3b0c356ad
commit
6d1d2eefd9
2 changed files with 7 additions and 7 deletions
|
|
@ -15,7 +15,7 @@ class TSFixedArray : public TSBaseArray<T> {
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
TSFixedArray<T>::~TSFixedArray() {
|
TSFixedArray<T>::~TSFixedArray() {
|
||||||
for (int32_t i = 0; i < this->Count(); i++) {
|
for (uint32_t i = 0; i < this->Count(); i++) {
|
||||||
auto element = &this->operator[](i);
|
auto element = &this->operator[](i);
|
||||||
element->~T();
|
element->~T();
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +30,7 @@ void TSFixedArray<T>::ReallocData(uint32_t count) {
|
||||||
T* oldData = this->m_data;
|
T* oldData = this->m_data;
|
||||||
|
|
||||||
if (count < this->m_count) {
|
if (count < this->m_count) {
|
||||||
for (int32_t i = count; i < this->m_count; i++) {
|
for (uint32_t i = count; i < this->m_count; i++) {
|
||||||
T* element = &this->m_data[i];
|
T* element = &this->m_data[i];
|
||||||
delete element;
|
delete element;
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +47,7 @@ void TSFixedArray<T>::ReallocData(uint32_t count) {
|
||||||
if (oldData) {
|
if (oldData) {
|
||||||
uint32_t smallestCount = count >= this->m_count ? this->m_count : count;
|
uint32_t smallestCount = count >= this->m_count ? this->m_count : count;
|
||||||
|
|
||||||
for (int32_t i = 0; i < smallestCount; i++) {
|
for (uint32_t i = 0; i < smallestCount; i++) {
|
||||||
T* v8 = &this->m_data[i];
|
T* v8 = &this->m_data[i];
|
||||||
|
|
||||||
if (v8) {
|
if (v8) {
|
||||||
|
|
@ -66,7 +66,7 @@ void TSFixedArray<T>::SetCount(uint32_t count) {
|
||||||
if (count) {
|
if (count) {
|
||||||
this->ReallocData(count);
|
this->ReallocData(count);
|
||||||
|
|
||||||
for (int32_t i = this->m_count; i < count; i++) {
|
for (uint32_t i = this->m_count; i < count; i++) {
|
||||||
new (&this->m_data[i]) T();
|
new (&this->m_data[i]) T();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ template <class T>
|
||||||
uint32_t TSGrowableArray<T>::Add(uint32_t count, const T* data) {
|
uint32_t TSGrowableArray<T>::Add(uint32_t count, const T* data) {
|
||||||
this->Reserve(count, 1);
|
this->Reserve(count, 1);
|
||||||
|
|
||||||
for (int32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
T* element = &this->m_data[this->m_count + i];
|
T* element = &this->m_data[this->m_count + i];
|
||||||
*element = data[i];
|
*element = data[i];
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ uint32_t TSGrowableArray<T>::Add(uint32_t count, uint32_t incr, const T* data) {
|
||||||
|
|
||||||
const char* dataptr = reinterpret_cast<const char*>(data);
|
const char* dataptr = reinterpret_cast<const char*>(data);
|
||||||
|
|
||||||
for (int32_t i = 0; i < count; i++) {
|
for (uint32_t i = 0; i < count; i++) {
|
||||||
T* element = &this->m_data[this->m_count + i];
|
T* element = &this->m_data[this->m_count + i];
|
||||||
*element = *reinterpret_cast<const T*>(dataptr);
|
*element = *reinterpret_cast<const T*>(dataptr);
|
||||||
dataptr += incr;
|
dataptr += incr;
|
||||||
|
|
@ -129,7 +129,7 @@ void TSGrowableArray<T>::SetCount(uint32_t count) {
|
||||||
|
|
||||||
T* element;
|
T* element;
|
||||||
|
|
||||||
for (int32_t i = this->m_count; i < count; ++i) {
|
for (uint32_t i = this->m_count; i < count; ++i) {
|
||||||
element = &this->m_data[i];
|
element = &this->m_data[i];
|
||||||
new (element) T();
|
new (element) T();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue