Update: stdme/os module

This commit is contained in:
Maieul BOYER 2024-04-29 15:12:51 +02:00
parent dfb10f3390
commit 16f49181b5
No known key found for this signature in database
37 changed files with 1201 additions and 345 deletions

View file

@ -17,15 +17,16 @@
#include "me/vec/vec_u8.h"
#include <stdlib.h>
t_error vec_u8_push_front(t_vec_u8 *vec, t_u8 element)
t_error vec_u8_push_front(t_vec_u8 *vec,
t_u8 element)
{
t_usize i;
t_usize i;
if (vec->len == 0)
return (vec_u8_push(vec, element));
i = vec->len - 1;
if (vec->capacity < vec->len + 1 && vec_u8_reserve(vec, 3 * vec->len / 2
+ 1))
if (vec->capacity < vec->len + 1 &&
vec_u8_reserve(vec, 3 * vec->len / 2 + 1))
return (ERROR);
while (i > 0)
{
@ -38,9 +39,9 @@ t_error vec_u8_push_front(t_vec_u8 *vec, t_u8 element)
return (NO_ERROR);
}
t_error vec_u8_pop_front(t_vec_u8 *vec, t_u8 *value)
t_error vec_u8_pop_front(t_vec_u8 *vec, t_u8 *value)
{
t_usize i;
t_usize i;
if (vec->len <= 1)
return (vec_u8_pop(vec, value));
@ -56,10 +57,10 @@ t_error vec_u8_pop_front(t_vec_u8 *vec, t_u8 *value)
return (NO_ERROR);
}
void vec_u8_reverse(t_vec_u8 *vec)
void vec_u8_reverse(t_vec_u8 *vec)
{
t_u8 temporary;
t_usize i;
t_u8 temporary;
t_usize i;
i = 0;
while (i < vec->len / 2)