Fix MSVC Spectre warnings

This commit is contained in:
abdelrahman committed 2025-05-04 23:59:50 +01:00
1 parent 12f083edb0
commit 2156d2ff3a
7 files changed
+8804 -8423

No files matched your search

+11 -3
View File
@@ -8,12 +8,20 @@
}}
{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;
for (u64 i = 0; i < items_to_add; ++i) {{
item = wapp_{Tlower}_array_get(other, i);
u64 item_index = 0;
bool running = true;
while (running) {{
item = wapp_{Tlower}_array_get(other, item_index);
++item_index;
running = item_index < items_to_add;
if (!item) {{
continue;
}}
wapp_{Tlower}_array_append_capped(array, *item);
}}
}}