aboutsummaryrefslogtreecommitdiff
path: root/src/coordinateManager.s
diff options
context:
space:
mode:
Diffstat (limited to 'src/coordinateManager.s')
-rw-r--r--src/coordinateManager.s51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/coordinateManager.s b/src/coordinateManager.s
deleted file mode 100644
index 4a46c9b..0000000
--- a/src/coordinateManager.s
+++ /dev/null
@@ -1,51 +0,0 @@
-# --------------------------------------------
-# FUNCTION: make_coordinate_buffer
-# PURPOSE : allocate memory for n coordinate tuples (16 bytes each)
-# INPUTS : rdi = number of coordinates
-# OUTPUTS : rax = pointer to allocated coordinate buffer
-# CLOBBERS: rax, rdi, r11
-# --------------------------------------------
-
-.globl make_coordinate_buffer
-.type make_coordinate_buffer, @function
-make_coordinate_buffer:
- imulq $16, %rdi # multiply n by 16
- call allocate # allocate total bytes
- ret
-
-
-# --------------------------------------------
-# FUNCTION: build_pointer_buffer
-# PURPOSE : build a buffer of pointers to coordinate tuples
-# INPUTS : rdi = coordinate buffer, rsi = number of tuples
-# OUTPUTS : rax = pointer buffer
-# CLOBBERS: rax, rcx, rdx, r8, r9
-# --------------------------------------------
-
-.globl build_pointer_buffer
-.type build_pointer_buffer, @function
-build_pointer_buffer:
- movq %rdi, %r8 # save coordinate buffer pointer in r8
- movq %rsi, %rax
- imulq $8, %rax # 1 pointer per coordinate / each pointer 8 bytes
- movq %rax, %rdi # argument for allocate
- call allocate # pointer buffer -> rax
- movq %rax, %r9 # save pointer buffer in r9
-
- movq $0, %rcx # index = 0
-pointer_loop:
- cmpq %rsi, %rcx # # if rcx >= n, done
- jge done
-
- movq %rcx, %rdx
- imulq $16, %rdx # 16 byte jumps / every pair of coordinates = 8 bytes + 8 bytes
- addq %r8, %rdx # rdX = coord_buffer + offset
- movq %rdx, (%r9,%rcx,8) # store pointer in pointer buffer / 8 byte jumps here, every pointer is 8 bytes
-
- incq %rcx
- jmp pointer_loop
-
-done:
- movq %r9, %rax # return pointer buffer
- ret
-