aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cunningham <cc@localhost>2024-07-14 09:17:40 -0700
committerChristian Cunningham <cc@localhost>2024-07-14 09:17:40 -0700
commitd0f1cf7f3759dfdb2fc41bd2316471a0cd1a7946 (patch)
tree5617f22b74daf325c0c8e46be1c12958d872e7c9
parente5fa482b1e58ef8e3370ab033b98a0775608c740 (diff)
Beginnings of Linked List
-rw-r--r--linked_list.inc34
1 files changed, 34 insertions, 0 deletions
diff --git a/linked_list.inc b/linked_list.inc
new file mode 100644
index 0000000..76a3956
--- /dev/null
+++ b/linked_list.inc
@@ -0,0 +1,34 @@
+%ifndef LINKED_LIST_INC
+%define LINKED_LIST_INC
+%ifndef ALLOC_INC
+%include "alloc.inc"
+%endif
+
+struc LinkedListNode
+ll_next: resq 1
+ll_value: resq 1
+endstruc
+
+struc DoublyLinkedListNode
+dll_next: resq 1
+dll_prev: resq 1
+dll_value: resq 1
+endstruc
+
+%macro alloc_lln 0
+ alloc LinkedListNode_size
+%endmacro
+
+%macro alloc_dlln 0
+ alloc DoublyLinkedListNode_size
+%endmacro
+
+%macro free_lln 0-1 rax
+ free %1, LinkedListNode_size
+%endmacro
+
+%macro free_dlln 0-1 rax
+ free %1, DoublyLinkedListNode_size
+%endmacro
+
+%endif