fix: use nasm struct

This commit is contained in:
lohhiiccc 2026-06-22 13:33:40 +02:00
parent accca3f538
commit bc61696ccb
2 changed files with 10 additions and 3 deletions

View file

@ -2,6 +2,10 @@ global ft_list_push_front
extern malloc extern malloc
extern ft_memcpy extern ft_memcpy
struc list
.data resq 1
.next resq 1
endstruc
%define NODE_SIZE 16 %define NODE_SIZE 16
section .text section .text
@ -48,7 +52,7 @@ ft_list_push_front:
; *begin_list = new_elem; ; *begin_list = new_elem;
mov [rax], rsi mov [rax], rsi
mov rdx, [rdi] mov rdx, [rdi]
mov [rax + 8], rdx mov [rax + list.next], rdx
mov [rdi], rax mov [rdi], rax
.done: .done:

View file

@ -1,6 +1,9 @@
global ft_list_size global ft_list_size
%define NODE_SIZE 16 struc list
.data resq 1
.next resq 1
endstruc
section .text section .text
@ -24,7 +27,7 @@ ft_list_size:
test rdi, rdi test rdi, rdi
je .done je .done
mov rdi, [rdi + 8] mov rdi, [rdi + list.next]
inc rax inc rax
jmp .loop jmp .loop