From d0f1cf7f3759dfdb2fc41bd2316471a0cd1a7946 Mon Sep 17 00:00:00 2001 From: Christian Cunningham Date: Sun, 14 Jul 2024 09:17:40 -0700 Subject: Beginnings of Linked List --- linked_list.inc | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 linked_list.inc 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 -- cgit v1.2.1