summaryrefslogtreecommitdiff
path: root/3/8_array_allocation_and_access/37_array_arithmetic.c
diff options
context:
space:
mode:
authorMike Vink <mike@pionative.com>2024-06-14 09:23:32 +0200
committerMike Vink <mike@pionative.com>2024-06-14 09:23:32 +0200
commit8092f4c334db547ced59d6f439b558dad35e1ab2 (patch)
treefa462fa885efea1ec6095d015286998d632c2c3d /3/8_array_allocation_and_access/37_array_arithmetic.c
parentb424517a33bf61aedff29eed74a665402ab496ba (diff)
commit for once
Diffstat (limited to '3/8_array_allocation_and_access/37_array_arithmetic.c')
-rw-r--r--3/8_array_allocation_and_access/37_array_arithmetic.c7
1 files changed, 7 insertions, 0 deletions
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