aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/memory/ordered_array.h
diff options
context:
space:
mode:
authorMarvin Borner2020-01-20 23:12:54 +0100
committerMarvin Borner2020-01-20 23:12:54 +0100
commit391ed256d21a6ae2e2456d1809f357e6e96e15d1 (patch)
tree0fe9ffb3c59bbfeb3d8a04ab7fc6efba60d81e79 /src/kernel/memory/ordered_array.h
parentd5d1749257ff8b9aa6b5ace4b4720b484a2860f3 (diff)
Added pure awesomeness
Actually quite some days of work but ok
Diffstat (limited to 'src/kernel/memory/ordered_array.h')
-rw-r--r--src/kernel/memory/ordered_array.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/kernel/memory/ordered_array.h b/src/kernel/memory/ordered_array.h
new file mode 100644
index 0000000..cf753e3
--- /dev/null
+++ b/src/kernel/memory/ordered_array.h
@@ -0,0 +1,31 @@
+#ifndef MELVIX_ORDERED_ARRAY_H
+#define MELVIX_ORDERED_ARRAY_H
+
+#include <stdint.h>
+
+typedef void *type_t;
+
+typedef int8_t (*lessthan_predicate_t)(type_t, type_t);
+
+typedef struct {
+ type_t *array;
+ uint32_t size;
+ uint32_t max_size;
+ lessthan_predicate_t less_than;
+} ordered_array_t;
+
+int8_t standard_lessthan_predicate(type_t a, type_t b);
+
+ordered_array_t create_ordered_array(uint32_t max_size, lessthan_predicate_t less_than);
+
+ordered_array_t place_ordered_array(void *addr, uint32_t max_size, lessthan_predicate_t less_than);
+
+void destroy_ordered_array(ordered_array_t *array);
+
+void insert_ordered_array(type_t item, ordered_array_t *array);
+
+type_t lookup_ordered_array(uint32_t i, ordered_array_t *array);
+
+void remove_ordered_array(uint32_t i, ordered_array_t *array);
+
+#endif