This commit is contained in:
2023-02-11 12:19:05 +06:00
parent 609dfcf3ed
commit 305854e721
77 changed files with 565 additions and 562 deletions

View File

@@ -26,23 +26,23 @@ create_block:\
ar->block_length++;\
}\
\
type __Autoarr_get_##type(Autoarr_##type* ar, uint32 index){\
type __Autoarr_get_##type(Autoarr_##type* ar, u32 index){\
if(index>=Autoarr_length(ar)) throw(ERR_WRONGINDEX);\
return ar->values[index/ar->max_block_length][index%ar->max_block_length];\
}\
\
type* __Autoarr_getptr_##type(Autoarr_##type* ar, uint32 index){\
type* __Autoarr_getptr_##type(Autoarr_##type* ar, u32 index){\
if(index>=Autoarr_length(ar)) throw(ERR_WRONGINDEX);\
return ar->values[index/ar->max_block_length]+(index%ar->max_block_length);\
}\
\
void __Autoarr_set_##type(Autoarr_##type* ar, uint32 index, type element){\
void __Autoarr_set_##type(Autoarr_##type* ar, u32 index, type element){\
if(index>=Autoarr_length(ar)) throw(ERR_WRONGINDEX);\
ar->values[index/ar->max_block_length][index%ar->max_block_length]=element;\
}\
\
void __Autoarr_free_##type(Autoarr_##type* ar, bool freePtr){\
for(uint16 i=0; i<ar->blocks_count;i++)\
for(u16 i=0; i<ar->blocks_count;i++)\
free(ar->values[i]); \
free(ar->values);\
if(freePtr) free(ar);\
@@ -52,9 +52,9 @@ void ____Autoarr_free_##type(void* ar){\
}\
\
type* __Autoarr_toArray_##type(Autoarr_##type* ar){\
uint32 length=Autoarr_length(ar);\
u32 length=Autoarr_length(ar);\
type* array=malloc(length * sizeof(type));\
for(uint32 i=0; i<length; i++)\
for(u32 i=0; i<length; i++)\
array[i]=__Autoarr_get_##type(ar, i);\
return array;\
}\
@@ -68,7 +68,7 @@ __functions_list_t_##type __functions_list_##type={\
&__Autoarr_toArray_##type\
};\
\
Autoarr_##type* __Autoarr_create_##type(uint16 max_blocks_count, uint16 max_block_length){\
Autoarr_##type* __Autoarr_create_##type(u16 max_blocks_count, u16 max_block_length){\
Autoarr_##type* ar=malloc(sizeof(Autoarr_##type));\
*ar=(Autoarr_##type){\
.max_blocks_count=max_blocks_count,\