From 20c208d46a140e148da29730a3adbfa9b88de467 Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Fri, 19 Aug 2022 21:19:30 +0300 Subject: util/array: unclutter --- include/util/array.h | 17 ----------------- include/util/set.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 include/util/set.h (limited to 'include') diff --git a/include/util/array.h b/include/util/array.h index 2b7278cc..a51bdb64 100644 --- a/include/util/array.h +++ b/include/util/array.h @@ -1,27 +1,10 @@ #ifndef UTIL_ARRAY_H #define UTIL_ARRAY_H -#include #include #include #include -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); - /** * Remove a chunk of memory of the specified size at the specified offset. */ 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 +#include +#include + +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 + -- cgit v1.2.3