regenerated stuff

This commit is contained in:
maix0 2024-09-26 18:31:56 +02:00
parent c284eb3786
commit 2e811bcec2
61 changed files with 1022 additions and 1697 deletions

View file

@ -15,7 +15,7 @@
#include "me/vec/vec_pid.h"
#include <stdlib.h>
t_pid *vec_pid_get(t_vec_pid *vec, t_usize i)
t_pid *vec_pid_get(t_vec_pid *vec, t_usize i)
{
if (vec == NULL || vec->buffer == NULL)
return (NULL);
@ -24,14 +24,14 @@ t_pid *vec_pid_get(t_vec_pid *vec, t_usize i)
return (NULL);
}
t_pid *vec_pid_last(t_vec_pid *vec)
t_pid *vec_pid_last(t_vec_pid *vec)
{
if (vec == NULL || vec->len == 0)
return (NULL);
return (&vec->buffer[vec->len - 1]);
}
void vec_pid_copy_into(t_vec_pid *vec, t_vec_pid *dest)
void vec_pid_copy_into(t_vec_pid *vec, t_vec_pid *dest)
{
if (vec == NULL || dest == NULL)
return ;
@ -39,19 +39,21 @@ void vec_pid_copy_into(t_vec_pid *vec, t_vec_pid *dest)
mem_copy(dest->buffer, vec->buffer, vec->len * sizeof(t_pid));
}
struct s_vec_pid_splice_arguments vec_pid_splice_args(t_usize index,
t_usize old_count, t_usize new_count, const t_pid *elements)
struct s_vec_pid_splice_arguments vec_pid_splice_args(
t_usize index, t_usize old_count, t_usize new_count,
const t_pid *elements)
{
return ((struct s_vec_pid_splice_arguments){index, old_count, new_count,
elements});
return ((struct s_vec_pid_splice_arguments){index, old_count,
new_count, elements});
}
void vec_pid_splice(t_vec_pid *self, struct s_vec_pid_splice_arguments args)
void vec_pid_splice(t_vec_pid *self,
struct s_vec_pid_splice_arguments args)
{
t_pid *contents;
t_u32 new_size;
t_u32 old_end;
t_u32 new_end;
t_pid *contents;
t_u32 new_size;
t_u32 old_end;
t_u32 new_end;
new_size = self->len + args.new_count - args.old_count;
old_end = args.index + args.old_count;
@ -59,16 +61,17 @@ void vec_pid_splice(t_vec_pid *self, struct s_vec_pid_splice_arguments args)
vec_pid_reserve(self, new_size);
contents = self->buffer;
if (self->len > old_end)
mem_move(contents + new_end, contents + old_end, (self->len - old_end)
* sizeof(t_pid));
mem_move(contents + new_end,
contents + old_end,
(self->len - old_end) * sizeof(t_pid));
if (args.new_count > 0)
{
if (args.elements)
mem_copy((contents + args.index * sizeof(t_pid)), args.elements,
args.new_count * sizeof(t_pid));
mem_copy((contents + args.index * sizeof(t_pid)),
args.elements, args.new_count * sizeof(t_pid));
else
mem_set_zero((contents + args.index * sizeof(t_pid)), args.new_count
* sizeof(t_pid));
mem_set_zero((contents + args.index * sizeof(t_pid)),
args.new_count * sizeof(t_pid));
}
self->len += args.new_count - args.old_count;
}