simplified Autoarr/Hashtable _foreach
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user