simplified Autoarr/Hashtable _foreach

This commit is contained in:
2023-05-20 01:40:16 +06:00
parent d7136055d9
commit 461aef3a00
19 changed files with 78 additions and 71 deletions

View File

@@ -23,20 +23,20 @@ Autoarr_declare(u64)
Autoarr_declare(Unitype)
#define Autoarr_foreach(ar,elem,codeblock)({ \
#define Autoarr_foreach(ar, elem, codeblock...) { \
if(ar->blocks_count>0) { \
typeof(**ar->values) elem; \
for(u16 blockI=0;blockI<ar->blocks_count-1;blockI++) \
for(u32 elemI=0;elemI<ar->max_block_length;elemI++){ \
elem=ar->values[blockI][elemI]; \
(codeblock); \
{ codeblock; } \
} \
for(u16 elemI=0;elemI<ar->block_length;elemI++){ \
elem=ar->values[ar->blocks_count-1][elemI]; \
(codeblock); \
{ codeblock; } \
} \
} \
})
}
#if __cplusplus
}