summaryrefslogtreecommitdiff
path: root/3/8_array_allocation_and_access/39_explain_rows_cols.c
diff options
context:
space:
mode:
Diffstat (limited to '3/8_array_allocation_and_access/39_explain_rows_cols.c')
-rw-r--r--3/8_array_allocation_and_access/39_explain_rows_cols.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/3/8_array_allocation_and_access/39_explain_rows_cols.c b/3/8_array_allocation_and_access/39_explain_rows_cols.c
new file mode 100644
index 0000000..7304f23
--- /dev/null
+++ b/3/8_array_allocation_and_access/39_explain_rows_cols.c
@@ -0,0 +1,8 @@
+// addq %rdx, %rdi Aptr = xa + 64i
+// fix_matrix = int[16][16], so each int is 4 bytes and we need to multiple by the number of columns to find the
+// i row, A + L(C*i + j) <=> A + 4(16*i)
+//
+// leaq (%rsi, %rcx, 4), %rcx Bptr = xb + 4k, this one is simple B + L(C*i + j) <=> B + 4(j), find the first row of the column j
+//
+// leaq 1024(%rcx), %rsi Bend = xb + 4k + 1024, find the N row of column k,
+// B + 4(16*16 + k) <=> B + 1024 + 4k