aboutsummaryrefslogtreecommitdiff
path: root/include/util/set.h
diff options
context:
space:
mode:
authorKirill Primak <vyivel@eclair.cafe>2022-08-19 21:19:30 +0300
committerSimon Zeni <simon@bl4ckb0ne.ca>2022-08-29 13:48:42 +0000
commit20c208d46a140e148da29730a3adbfa9b88de467 (patch)
treed4dbb917ec6c7e77692adafc8b87d5e5d3a131f8 /include/util/set.h
parenteee0f5e71f4e3a6ded27d2d5046a243277c00ab8 (diff)
util/array: unclutter
Diffstat (limited to 'include/util/set.h')
-rw-r--r--include/util/set.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/util/set.h b/include/util/set.h
new file mode 100644
index 00000000..41099621
--- /dev/null
+++ b/include/util/set.h
@@ -0,0 +1,25 @@
+#ifndef UTIL_SET_H
+#define UTIL_SET_H
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
+
+size_t push_zeroes_to_end(uint32_t arr[], size_t n);
+
+/**
+ * Add `target` to `values` if it doesn't exist
+ * "set"s should only be modified with set_* functions
+ * Values MUST be greater than 0
+ */
+bool set_add(uint32_t values[], size_t *len, size_t cap, uint32_t target);
+
+/**
+ * Remove `target` from `values` if it exists
+ * "set"s should only be modified with set_* functions
+ * Values MUST be greater than 0
+ */
+bool set_remove(uint32_t values[], size_t *len, size_t cap, uint32_t target);
+
+#endif
+