1#pragma once
2
3/*
4 * Set internals.
5 */
6
7#include "include/pw_types.h"
8#include "src/types/hash_table.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14// capacity must be power of two, it doubles when set needs to grow
15#define PWSET_INITIAL_CAPACITY 8
16
17PW_STRUCT(_PwSet) {
18 _PwArray items; // items in the insertion order
19 _PwHashTable hash_table;
20};
21
22#define get_set(value) \
23 __extension__ \
24 ({ \
25 _PwSet* __set = _pw_get_struct_ptr((value), PwTypeId_BasicSet); \
26 if (!__set) { \
27 pw_set_status(PwStatus(PweIncompatibleType, "Expected set")); \
28 } \
29 __set; \
30 })
31
32extern PwInterface_Basic _pw_basic_set_basic_interface;
33
34#ifdef __cplusplus
35}
36#endif