aboutsummaryrefslogtreecommitdiff
path: root/linked_list.inc
diff options
context:
space:
mode:
Diffstat (limited to 'linked_list.inc')
-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