From 8092f4c334db547ced59d6f439b558dad35e1ab2 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Fri, 14 Jun 2024 09:23:32 +0200 Subject: commit for once --- 3/8_array_allocation_and_access/37_array_arithmetic.c | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 3/8_array_allocation_and_access/37_array_arithmetic.c (limited to '3/8_array_allocation_and_access/37_array_arithmetic.c') diff --git a/3/8_array_allocation_and_access/37_array_arithmetic.c b/3/8_array_allocation_and_access/37_array_arithmetic.c new file mode 100644 index 0000000..c2ecbf2 --- /dev/null +++ b/3/8_array_allocation_and_access/37_array_arithmetic.c @@ -0,0 +1,7 @@ +// S and i in rdx and rcx +// type value assembly +// S+1 short * xs + 2 leaq $2(%rdx), %rax, // leaq since we want to store the address not the value +// S[3] short M[xs+6] movw $6(%rdx), %ax +// &S[i] short * xs+2i leaq (rdx, rcx, 2), %rax +// S[4*i+1] short M[xs+8i+2] movw $2(%rdx, %rcx, 8), %ax +// S+i-5 short * xs+2i-10 leaq $-10(%rdx, %rcx, 2), %rax -- cgit v1.2.3