tsv3 start ig
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user