ftest.c: optimize is_in_array_

This commit is contained in:
2025-06-09 22:58:35 +02:00
parent 05ac1f2f3c
commit 085d2c65e4
2 changed files with 5 additions and 4 deletions
Binary file not shown.
+2 -1
View File
@@ -1012,10 +1012,11 @@ stat_end_run(size_t ntst, struct timespec start_t){
bool is_in_array_##type(type *array, type val){\ bool is_in_array_##type(type *array, type val){\
bool found = false;\ bool found = false;\
for(size_t i = 0; i < cur_array_##type; ++i){\ for(size_t i = 0; i < cur_array_##type; ++i){\
if(debug){\
char * strarr = type##_TO_STR(array[i]), *strval = type##_TO_STR(val);\ char * strarr = type##_TO_STR(array[i]), *strval = type##_TO_STR(val);\
PRINT_DEBUG("compare |%s| in array and val: |%s|\n",strarr, strval);\ PRINT_DEBUG("compare |%s| in array and val: |%s|\n",strarr, strval);\
if(strcmp(#type, "TYPE_STRING" ) != 0 ){ free(strarr);free(strval); }\ if(strcmp(#type, "TYPE_STRING" ) != 0 ){ free(strarr);free(strval); }\
/*PRINT_DEBUG("compare |%s| in array and val: |%s|\n",type##_TO_STR(array[i]), type##_TO_STR(val));*/\ }/*PRINT_DEBUG("compare |%s| in array and val: |%s|\n",type##_TO_STR(array[i]), type##_TO_STR(val));*/\
if(COMPARE_N_##type((void*)(&array[i]),(void*)&val ) == 0 ){\ if(COMPARE_N_##type((void*)(&array[i]),(void*)&val ) == 0 ){\
found = true;\ found = true;\
break;\ break;\