Fix MSVC Spectre warnings
This commit is contained in:
@@ -5,12 +5,20 @@
|
||||
wapp_{Tlower}_array_clear(dst);
|
||||
|
||||
{T} *item;
|
||||
u64 to_copy = src->count < dst->capacity ? src->count : dst->capacity;
|
||||
for (u64 i = 0; i < to_copy; ++i) {{
|
||||
item = wapp_{Tlower}_array_get(src, i);
|
||||
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// 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) {{
|
||||
continue;
|
||||
}}
|
||||
|
||||
|
||||
wapp_{Tlower}_array_append_capped(dst, *item);
|
||||
}}
|
||||
|
Reference in New Issue
Block a user