Fix MSVC errors
This commit is contained in:
@@ -11,9 +11,15 @@ void _queue_pop_front(GenericQueue *queue, void *output, u64 item_size) {
|
|||||||
|
|
||||||
memcpy(output, queue->items, item_size);
|
memcpy(output, queue->items, item_size);
|
||||||
|
|
||||||
|
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||||
|
// MSVC Spectre mitigation warnings
|
||||||
u64 new_count = wapp_array_count(queue->items) - 1;
|
u64 new_count = wapp_array_count(queue->items) - 1;
|
||||||
for (u64 i = 0; i < new_count; ++i) {
|
u64 index = 0;
|
||||||
_array_set(queue->items, i, _array_get(queue->items, i + 1, item_size), item_size);
|
b8 running = index < new_count;
|
||||||
|
while (running) {
|
||||||
|
_array_set(queue->items, index, _array_get(queue->items, index + 1, item_size), item_size);
|
||||||
|
++index;
|
||||||
|
running = index < new_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
wapp_array_set_count(queue->items, new_count);
|
wapp_array_set_count(queue->items, new_count);
|
||||||
|
|||||||
Reference in New Issue
Block a user