Fix MSVC Spectre warnings
This commit is contained in:
parent
12f083edb0
commit
2156d2ff3a
@ -5,9 +5,17 @@
|
|||||||
wapp_{Tlower}_array_clear(dst);
|
wapp_{Tlower}_array_clear(dst);
|
||||||
|
|
||||||
{T} *item;
|
{T} *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {{
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_{Tlower}_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {{
|
||||||
|
item = wapp_{Tlower}_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {{
|
if (!item) {{
|
||||||
continue;
|
continue;
|
||||||
}}
|
}}
|
||||||
|
@ -8,9 +8,17 @@
|
|||||||
}}
|
}}
|
||||||
|
|
||||||
{T} *item;
|
{T} *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {{
|
u64 item_index = 0;
|
||||||
item = wapp_{Tlower}_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {{
|
||||||
|
item = wapp_{Tlower}_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {{
|
if (!item) {{
|
||||||
continue;
|
continue;
|
||||||
}}
|
}}
|
||||||
|
@ -46,9 +46,17 @@ void wapp_str8_array_extend_capped(Str8Array *array, const Str8Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Str8 *item;
|
Str8 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_str8_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_str8_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -81,9 +89,17 @@ void wapp_str8_array_copy_capped(const Str8Array *src, Str8Array *dst) {
|
|||||||
wapp_str8_array_clear(dst);
|
wapp_str8_array_clear(dst);
|
||||||
|
|
||||||
Str8 *item;
|
Str8 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_str8_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_str8_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -218,9 +234,17 @@ void wapp_void_ptr_array_extend_capped(VoidPArray *array, const VoidPArray *othe
|
|||||||
}
|
}
|
||||||
|
|
||||||
void * *item;
|
void * *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_void_ptr_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_void_ptr_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -253,9 +277,17 @@ void wapp_void_ptr_array_copy_capped(const VoidPArray *src, VoidPArray *dst) {
|
|||||||
wapp_void_ptr_array_clear(dst);
|
wapp_void_ptr_array_clear(dst);
|
||||||
|
|
||||||
void * *item;
|
void * *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_void_ptr_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_void_ptr_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -390,9 +422,17 @@ void wapp_bool_array_extend_capped(BoolArray *array, const BoolArray *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool *item;
|
bool *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_bool_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_bool_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -425,9 +465,17 @@ void wapp_bool_array_copy_capped(const BoolArray *src, BoolArray *dst) {
|
|||||||
wapp_bool_array_clear(dst);
|
wapp_bool_array_clear(dst);
|
||||||
|
|
||||||
bool *item;
|
bool *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_bool_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_bool_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -562,9 +610,17 @@ void wapp_char_array_extend_capped(CharArray *array, const CharArray *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
char *item;
|
char *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_char_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_char_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -597,9 +653,17 @@ void wapp_char_array_copy_capped(const CharArray *src, CharArray *dst) {
|
|||||||
wapp_char_array_clear(dst);
|
wapp_char_array_clear(dst);
|
||||||
|
|
||||||
char *item;
|
char *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_char_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_char_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -734,9 +798,17 @@ void wapp_c8_array_extend_capped(C8Array *array, const C8Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c8 *item;
|
c8 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_c8_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_c8_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -769,9 +841,17 @@ void wapp_c8_array_copy_capped(const C8Array *src, C8Array *dst) {
|
|||||||
wapp_c8_array_clear(dst);
|
wapp_c8_array_clear(dst);
|
||||||
|
|
||||||
c8 *item;
|
c8 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_c8_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_c8_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -906,9 +986,17 @@ void wapp_c16_array_extend_capped(C16Array *array, const C16Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c16 *item;
|
c16 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_c16_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_c16_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -941,9 +1029,17 @@ void wapp_c16_array_copy_capped(const C16Array *src, C16Array *dst) {
|
|||||||
wapp_c16_array_clear(dst);
|
wapp_c16_array_clear(dst);
|
||||||
|
|
||||||
c16 *item;
|
c16 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_c16_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_c16_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1078,9 +1174,17 @@ void wapp_c32_array_extend_capped(C32Array *array, const C32Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c32 *item;
|
c32 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_c32_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_c32_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1113,9 +1217,17 @@ void wapp_c32_array_copy_capped(const C32Array *src, C32Array *dst) {
|
|||||||
wapp_c32_array_clear(dst);
|
wapp_c32_array_clear(dst);
|
||||||
|
|
||||||
c32 *item;
|
c32 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_c32_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_c32_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1250,9 +1362,17 @@ void wapp_i8_array_extend_capped(I8Array *array, const I8Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i8 *item;
|
i8 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_i8_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i8_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1285,9 +1405,17 @@ void wapp_i8_array_copy_capped(const I8Array *src, I8Array *dst) {
|
|||||||
wapp_i8_array_clear(dst);
|
wapp_i8_array_clear(dst);
|
||||||
|
|
||||||
i8 *item;
|
i8 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_i8_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i8_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1422,9 +1550,17 @@ void wapp_i16_array_extend_capped(I16Array *array, const I16Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i16 *item;
|
i16 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_i16_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i16_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1457,9 +1593,17 @@ void wapp_i16_array_copy_capped(const I16Array *src, I16Array *dst) {
|
|||||||
wapp_i16_array_clear(dst);
|
wapp_i16_array_clear(dst);
|
||||||
|
|
||||||
i16 *item;
|
i16 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_i16_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i16_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1594,9 +1738,17 @@ void wapp_i32_array_extend_capped(I32Array *array, const I32Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i32 *item;
|
i32 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_i32_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i32_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1629,9 +1781,17 @@ void wapp_i32_array_copy_capped(const I32Array *src, I32Array *dst) {
|
|||||||
wapp_i32_array_clear(dst);
|
wapp_i32_array_clear(dst);
|
||||||
|
|
||||||
i32 *item;
|
i32 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_i32_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i32_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1766,9 +1926,17 @@ void wapp_i64_array_extend_capped(I64Array *array, const I64Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
i64 *item;
|
i64 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_i64_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i64_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1801,9 +1969,17 @@ void wapp_i64_array_copy_capped(const I64Array *src, I64Array *dst) {
|
|||||||
wapp_i64_array_clear(dst);
|
wapp_i64_array_clear(dst);
|
||||||
|
|
||||||
i64 *item;
|
i64 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_i64_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_i64_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1938,9 +2114,17 @@ void wapp_u8_array_extend_capped(U8Array *array, const U8Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u8 *item;
|
u8 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_u8_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u8_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1973,9 +2157,17 @@ void wapp_u8_array_copy_capped(const U8Array *src, U8Array *dst) {
|
|||||||
wapp_u8_array_clear(dst);
|
wapp_u8_array_clear(dst);
|
||||||
|
|
||||||
u8 *item;
|
u8 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_u8_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u8_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2110,9 +2302,17 @@ void wapp_u16_array_extend_capped(U16Array *array, const U16Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u16 *item;
|
u16 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_u16_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u16_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2145,9 +2345,17 @@ void wapp_u16_array_copy_capped(const U16Array *src, U16Array *dst) {
|
|||||||
wapp_u16_array_clear(dst);
|
wapp_u16_array_clear(dst);
|
||||||
|
|
||||||
u16 *item;
|
u16 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_u16_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u16_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2282,9 +2490,17 @@ void wapp_u32_array_extend_capped(U32Array *array, const U32Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u32 *item;
|
u32 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_u32_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u32_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2317,9 +2533,17 @@ void wapp_u32_array_copy_capped(const U32Array *src, U32Array *dst) {
|
|||||||
wapp_u32_array_clear(dst);
|
wapp_u32_array_clear(dst);
|
||||||
|
|
||||||
u32 *item;
|
u32 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_u32_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u32_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2454,9 +2678,17 @@ void wapp_u64_array_extend_capped(U64Array *array, const U64Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
u64 *item;
|
u64 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_u64_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u64_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2489,9 +2721,17 @@ void wapp_u64_array_copy_capped(const U64Array *src, U64Array *dst) {
|
|||||||
wapp_u64_array_clear(dst);
|
wapp_u64_array_clear(dst);
|
||||||
|
|
||||||
u64 *item;
|
u64 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_u64_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_u64_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2626,9 +2866,17 @@ void wapp_f32_array_extend_capped(F32Array *array, const F32Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f32 *item;
|
f32 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_f32_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_f32_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2661,9 +2909,17 @@ void wapp_f32_array_copy_capped(const F32Array *src, F32Array *dst) {
|
|||||||
wapp_f32_array_clear(dst);
|
wapp_f32_array_clear(dst);
|
||||||
|
|
||||||
f32 *item;
|
f32 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_f32_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_f32_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2798,9 +3054,17 @@ void wapp_f64_array_extend_capped(F64Array *array, const F64Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f64 *item;
|
f64 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_f64_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_f64_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2833,9 +3097,17 @@ void wapp_f64_array_copy_capped(const F64Array *src, F64Array *dst) {
|
|||||||
wapp_f64_array_clear(dst);
|
wapp_f64_array_clear(dst);
|
||||||
|
|
||||||
f64 *item;
|
f64 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_f64_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_f64_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2970,9 +3242,17 @@ void wapp_f128_array_extend_capped(F128Array *array, const F128Array *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
f128 *item;
|
f128 *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_f128_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_f128_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3005,9 +3285,17 @@ void wapp_f128_array_copy_capped(const F128Array *src, F128Array *dst) {
|
|||||||
wapp_f128_array_clear(dst);
|
wapp_f128_array_clear(dst);
|
||||||
|
|
||||||
f128 *item;
|
f128 *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_f128_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_f128_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3142,9 +3430,17 @@ void wapp_iptr_array_extend_capped(IptrArray *array, const IptrArray *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
iptr *item;
|
iptr *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_iptr_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_iptr_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3177,9 +3473,17 @@ void wapp_iptr_array_copy_capped(const IptrArray *src, IptrArray *dst) {
|
|||||||
wapp_iptr_array_clear(dst);
|
wapp_iptr_array_clear(dst);
|
||||||
|
|
||||||
iptr *item;
|
iptr *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_iptr_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_iptr_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3314,9 +3618,17 @@ void wapp_uptr_array_extend_capped(UptrArray *array, const UptrArray *other) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uptr *item;
|
uptr *item;
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 items_to_add = other->count;
|
u64 items_to_add = other->count;
|
||||||
for (u64 i = 0; i < items_to_add; ++i) {
|
u64 item_index = 0;
|
||||||
item = wapp_uptr_array_get(other, i);
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_uptr_array_get(other, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < items_to_add;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3349,9 +3661,17 @@ void wapp_uptr_array_copy_capped(const UptrArray *src, UptrArray *dst) {
|
|||||||
wapp_uptr_array_clear(dst);
|
wapp_uptr_array_clear(dst);
|
||||||
|
|
||||||
uptr *item;
|
uptr *item;
|
||||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
|
||||||
for (u64 i = 0; i < to_copy; ++i) {
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
item = wapp_uptr_array_get(src, i);
|
// MSVC Spectre mitigation warnings
|
||||||
|
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||||
|
u64 item_index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
item = wapp_uptr_array_get(src, item_index);
|
||||||
|
++item_index;
|
||||||
|
running = item_index < to_copy;
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,15 @@ TestFuncResult test_i32_array(void) {
|
|||||||
result = array.count == 7 && array.capacity == 16;
|
result = array.count == 7 && array.capacity == 16;
|
||||||
|
|
||||||
i32 *item;
|
i32 *item;
|
||||||
u64 count = array.count;
|
u64 count = array.count;
|
||||||
for (u64 i = 0; i < count; ++i) {
|
u64 index = 0;
|
||||||
item = wapp_i32_array_get(&array, i);
|
bool running = true;
|
||||||
result = result && item && (*item == (i32)(i + 1));
|
while (running) {
|
||||||
|
item = wapp_i32_array_get(&array, index);
|
||||||
|
result = result && item && (*item == (i32)(index + 1));
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
@ -33,10 +38,15 @@ TestFuncResult test_i32_array_get(void) {
|
|||||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
|
||||||
i32 *item;
|
i32 *item;
|
||||||
u64 count = array.count;
|
u64 count = array.count;
|
||||||
for (u64 i = 0; i < count; ++i) {
|
u64 index = 0;
|
||||||
item = wapp_i32_array_get(&array, i);
|
bool running = true;
|
||||||
result = result && item && (*item == (i32)i);
|
while (running) {
|
||||||
|
item = wapp_i32_array_get(&array, index);
|
||||||
|
result = result && item && (*item == (i32)index);
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
@ -48,11 +58,16 @@ TestFuncResult test_i32_array_set(void) {
|
|||||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||||
|
|
||||||
i32 *item;
|
i32 *item;
|
||||||
u64 count = array.count;
|
u64 count = array.count;
|
||||||
for (u64 i = 0; i < count; ++i) {
|
u64 index = 0;
|
||||||
wapp_i32_array_set(&array, i, (i32)(i * 2));
|
bool running = true;
|
||||||
item = wapp_i32_array_get(&array, i);
|
while (running) {
|
||||||
result = result && item && (*item == (i32)(i * 2));
|
wapp_i32_array_set(&array, index, (i32)(index * 2));
|
||||||
|
item = wapp_i32_array_get(&array, index);
|
||||||
|
result = result && item && (*item == (i32)(index * 2));
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
@ -133,15 +148,27 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
|||||||
u64 expected_count = 5;
|
u64 expected_count = 5;
|
||||||
wapp_i32_array_copy_capped(&src, &dst1);
|
wapp_i32_array_copy_capped(&src, &dst1);
|
||||||
result = dst1.count == expected_count;
|
result = dst1.count == expected_count;
|
||||||
for (u64 i = 0; i < expected_count; ++i) {
|
|
||||||
result = result && (*wapp_i32_array_get(&src, i) == *wapp_i32_array_get(&dst1, i));
|
u64 index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(&dst1, index));
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < expected_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_count = 4;
|
expected_count = 4;
|
||||||
wapp_i32_array_copy_capped(&src, &dst2);
|
wapp_i32_array_copy_capped(&src, &dst2);
|
||||||
result = result && dst2.count == expected_count;
|
result = result && dst2.count == expected_count;
|
||||||
for (u64 i = 0; i < expected_count; ++i) {
|
|
||||||
result = result && (*wapp_i32_array_get(&src, i) == *wapp_i32_array_get(&dst2, i));
|
index = 0;
|
||||||
|
running = true;
|
||||||
|
while (running) {
|
||||||
|
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(&dst2, index));
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < expected_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
@ -171,8 +198,14 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
|||||||
I32Array *arr_ptr = wapp_i32_array_append_alloc(&allocator, &array1, 10);
|
I32Array *arr_ptr = wapp_i32_array_append_alloc(&allocator, &array1, 10);
|
||||||
result = arr_ptr == &array1;
|
result = arr_ptr == &array1;
|
||||||
|
|
||||||
for (u64 i = 0; i < 4; ++i) {
|
u64 count = 4;
|
||||||
arr_ptr = wapp_i32_array_append_alloc(&allocator, &array2, (i32)i);
|
u64 index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
arr_ptr = wapp_i32_array_append_alloc(&allocator, &array2, (i32)index);
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < count;
|
||||||
}
|
}
|
||||||
result = result && arr_ptr != &array2;
|
result = result && arr_ptr != &array2;
|
||||||
|
|
||||||
@ -212,15 +245,27 @@ TestFuncResult test_i32_array_copy_alloc(void) {
|
|||||||
u64 expected_count = 5;
|
u64 expected_count = 5;
|
||||||
array_ptr = wapp_i32_array_copy_alloc(&allocator, &src, &dst1);
|
array_ptr = wapp_i32_array_copy_alloc(&allocator, &src, &dst1);
|
||||||
result = array_ptr->count == expected_count && array_ptr == &dst1;
|
result = array_ptr->count == expected_count && array_ptr == &dst1;
|
||||||
for (u64 i = 0; i < expected_count; ++i) {
|
|
||||||
result = result && (*wapp_i32_array_get(&src, i) == *wapp_i32_array_get(array_ptr, i));
|
u64 index = 0;
|
||||||
|
bool running = true;
|
||||||
|
while (running) {
|
||||||
|
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(array_ptr, index));
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < expected_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
expected_count = 5;
|
expected_count = 5;
|
||||||
array_ptr = wapp_i32_array_copy_alloc(&allocator, &src, &dst2);
|
array_ptr = wapp_i32_array_copy_alloc(&allocator, &src, &dst2);
|
||||||
result = result && array_ptr->count == expected_count && array_ptr != &dst2;
|
result = result && array_ptr->count == expected_count && array_ptr != &dst2;
|
||||||
for (u64 i = 0; i < expected_count; ++i) {
|
|
||||||
result = result && (*wapp_i32_array_get(&src, i) == *wapp_i32_array_get(array_ptr, i));
|
index = 0;
|
||||||
|
running = true;
|
||||||
|
while (running) {
|
||||||
|
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(array_ptr, index));
|
||||||
|
|
||||||
|
++index;
|
||||||
|
running = index < expected_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
wapp_mem_arena_allocator_destroy(&allocator);
|
wapp_mem_arena_allocator_destroy(&allocator);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user