tsv3 start ig

This commit is contained in:
suchmememanyskill
2021-07-09 22:56:13 +02:00
parent 804ba3495c
commit 2ddc7ae2a9
51 changed files with 3188 additions and 1749 deletions

View File

@@ -1,4 +1,5 @@
#include "vector.h"
#include "../gfx/gfx.h"
#include <string.h>
#include <mem/heap.h>
@@ -44,8 +45,7 @@ int _vecAdd(Vector_t* v, void* elem, u8 sz) {
if (v->data == NULL) {
v->data = calloc(1, v->elemSz);
}
u32 usedbytes = v->count * sz;
u32 usedbytes = v->count * (u32)v->elemSz;
if (usedbytes >= v->capacity)
{
v->capacity *= 2;
@@ -56,8 +56,7 @@ int _vecAdd(Vector_t* v, void* elem, u8 sz) {
free(v->data);
v->data = buff;
}
memcpy((char*)v->data + usedbytes, elem, sz);
memcpy(((u8*)v->data) + usedbytes, elem, v->elemSz);
v->count++;
return 1;
}