diff options
author | Christian Cunningham <cc@localhost> | 2024-07-14 09:54:54 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2024-07-14 09:54:54 -0700 |
commit | f4c8ec9028f19fe334ecd4ae49521011fcdba012 (patch) | |
tree | 78d8a98ebfbfeb16777076ee17dd297b019b13a1 /linked_list.inc | |
parent | 7d7f6aee29067234baecd771637f123f928f0bf0 (diff) |
Single Linked List Impl
Diffstat (limited to 'linked_list.inc')
-rw-r--r-- | linked_list.inc | 18 |
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 |