aboutsummaryrefslogtreecommitdiff
path: root/include/lib/ll.h
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2022-01-05 14:27:09 -0800
committerChristian Cunningham <cc@localhost>2022-01-05 14:27:09 -0800
commit866a6ca0e749f4446b7fdc7579a6d553df85ec10 (patch)
treed259223d85c224d649c6c38675e99b155d50cf48 /include/lib/ll.h
parent3a8ed19bf83f11ff00c4904fab2cc083b7e33478 (diff)
Moved includes to its own directory
Diffstat (limited to 'include/lib/ll.h')
-rw-r--r--include/lib/ll.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/lib/ll.h b/include/lib/ll.h
new file mode 100644
index 0000000..ab4148d
--- /dev/null
+++ b/include/lib/ll.h
@@ -0,0 +1,24 @@
+#ifndef LIB_LL_H
+#define LIB_LL_H
+
+struct LL {
+ struct LL* prev;
+ struct LL* next;
+ void* data;
+};
+
+struct LL* new_ll(void* val);
+void push_ll(struct LL* l, void* val);
+void remove_ll(struct LL* l, unsigned long idx);
+
+#define show_ll(L, TYPE) { \
+ struct LL* t = L; \
+ do { \
+ uart_hex(*(TYPE*)t->data); \
+ t = t->next; \
+ if (t != l) \
+ uart_char(' '); \
+ } while (t != l); \
+}
+
+#endif