diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2023-07-16 02:03:33 +0200 |
commit | 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 (patch) | |
tree | cb21506e7b04d10b45d6066a0ee1655563d5d52b /external/hash/ptr_set.h |
Squashed 'flatcc/' content from commit 473da2a
git-subtree-dir: flatcc
git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5
Diffstat (limited to 'external/hash/ptr_set.h')
-rw-r--r-- | external/hash/ptr_set.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/external/hash/ptr_set.h b/external/hash/ptr_set.h new file mode 100644 index 0000000..f66e70e --- /dev/null +++ b/external/hash/ptr_set.h @@ -0,0 +1,19 @@ +#ifndef HT_PTR_SET_H +#define HT_PTR_SET_H + +#include "hash_table.h" + +DECLARE_HASH_TABLE(ptr_set, void *) + +/* Return value helpers - these are specific to the implementation. */ +#define PTR_SET_IS_MISSING(x) ((void *)x == (void *)0) +#define PTR_SET_IS_ERROR(x) ((void *)x == (void *)2) +#define PTR_SET_IS_VALID(x) ((void *)x > (void *)2) + +/* Extensions to std. interface. */ +static inline int ptr_set_exists(ptr_set_t *S, void *p) +{ + return ptr_set_find_item(S, p) != (void *)0; +} + +#endif /* HT_PTR_SET_H */ |