From 5a40295c4cf0af5ea8da9ced04a4ce7d3621a080 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 16 Jul 2023 02:03:33 +0200 Subject: Squashed 'flatcc/' content from commit 473da2a git-subtree-dir: flatcc git-subtree-split: 473da2afa5ca435363f8c5e6569167aee6bc31c5 --- external/hash/ptr_set.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 external/hash/ptr_set.h (limited to 'external/hash/ptr_set.h') 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 */ -- cgit v1.2.3