summaryrefslogtreecommitdiff
path: root/src/geset.h
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-01-02 04:53:46 +0100
committerThomas Voss <mail@thomasvoss.com> 2023-01-02 04:53:46 +0100
commitd0c3309518b432bdd956ac3559517e708ca009cb (patch)
tree22776b800cf94ab716c7ce2dc8dbf52c537735eb /src/geset.h
parent62bb46a48cb9ecad96e1fe3591253243c2fb614e (diff)
Add the _intersects() functionHEADmaster
Diffstat (limited to 'src/geset.h')
-rw-r--r--src/geset.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/geset.h b/src/geset.h
index a87692b..320aa51 100644
--- a/src/geset.h
+++ b/src/geset.h
@@ -39,6 +39,7 @@
bool n##_has(n_t *, t); \
size_t n##_size(n_t *); \
bool n##_empty(n_t *); \
+ bool n##_intersects(n_t *, n_t *); \
int n##_remove(n_t *, t); \
int n##_resize(n_t *, size_t); \
bool int_n##_key_iseq(t, t); \
@@ -99,6 +100,16 @@
return int_n##_empty(set); \
} \
\
+ bool \
+ n##_intersects(n_t *a, n_t *b) \
+ { \
+ GESET_FOREACH(n, t, e, *a) { \
+ if (n##_has(b, e)) \
+ return true; \
+ } \
+ return false; \
+ } \
+ \
int \
n##_remove(n_t *set, t e) \
{ \