aboutsummaryrefslogtreecommitdiff
path: root/linked_list.inc
diff options
context:
space:
mode:
Diffstat (limited to 'linked_list.inc')
-rw-r--r--linked_list.inc18
1 files changed, 14 insertions, 4 deletions
diff --git a/linked_list.inc b/linked_list.inc
index 76a3956..4fbb923 100644
--- a/linked_list.inc
+++ b/linked_list.inc
@@ -15,20 +15,30 @@ dll_prev: resq 1
dll_value: resq 1
endstruc
-%macro alloc_lln 0
+%macro lln_alloc 0
alloc LinkedListNode_size
+ mov qword [rax + ll_next], 0
%endmacro
-%macro alloc_dlln 0
+%macro dlln_alloc 0
alloc DoublyLinkedListNode_size
+ mov qword [rax + dll_next], 0
%endmacro
-%macro free_lln 0-1 rax
+%macro lln_free 0-1 rax
free %1, LinkedListNode_size
%endmacro
-%macro free_dlln 0-1 rax
+%macro dlln_free 0-1 rax
free %1, DoublyLinkedListNode_size
%endmacro
+%macro ll_push 2
+ ;; %1 = Current Linked List Node
+ ;; %2 = Value to push (Must fit in a register, larger must be pushed as pointer to the underlying structure)
+ lln_alloc
+ mov qword [%1 + ll_next], rax
+ mov qword [rax + ll_value], %2
+%endm
+
%endif