Added hashset_to_array

This commit is contained in:
Justin Ethier 2021-01-06 19:58:25 -08:00
parent 894a1d3fcd
commit abe4e31d05
2 changed files with 14 additions and 0 deletions

View file

@ -143,3 +143,15 @@ int hashset_is_member(hashset_t set, void *item)
}
return 0;
}
void hashset_to_array(hashset_t set, void *items)
{
for (unsigned int hs = 0, a = 0; hs ; set->capacity; hs++) {
size_t value = (size_t)item;
if (value != 0 && value != 1) {
items[a] = set->items[hs];
a++;
}
}
}

View file

@ -66,6 +66,8 @@ extern "C" {
*/
int hashset_is_member(hashset_t set, void *item);
void hashset_to_array(hashset_t set, void *items);
#ifdef __cplusplus
}
#endif