aboutsummaryrefslogtreecommitdiff
path: root/report
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--report/report.tex30
1 files changed, 27 insertions, 3 deletions
diff --git a/report/report.tex b/report/report.tex
index 8989253..ea688ac 100644
--- a/report/report.tex
+++ b/report/report.tex
@@ -195,11 +195,35 @@ We implemented a global function \texttt{array\_maker}, that takes the
array, and the number of elements. With this it then first calls a function
\texttt{create\_file\_buffer}, that reads the contents of the file and puts it
in memory. It then passes this address, and the length of the file onto the
-function \texttt{make\_pairwise\_data}
+function \texttt{make\_pairwise\_data}. This function removes
+\texttt{\textbackslash t} and \texttt{\textbackslash n}, and puts the integers
+side-by-side, with space for 64-bit integers. This format is nice, because it
+allows us to iterate over the number of coordinates, and select every $2n$ pair
+as the place in memory where the $n^\text{th}$ pair in the array points to.
+
+
+\begin{algorithm}[H]
+ \DontPrintSemicolon % optional: removes ;
+ \SetKwInOut{Input}{Input}
+ \SetKwInOut{Output}{Output}
+
+ \Input{File descriptor $f$}
+ \Output{Pointer and size of array $A$}
+ \BlankLine
+
+ \texttt{// Pointer to file data in $p$ and length of that data in $n$.}\\
+ $p,n\leftarrow$ create\_file\_buffer($f$)\\
+ \texttt{// Pointer to pairwise data in $p$ and number of pairs in $n$}\\
+ $p,n\leftarrow$ make\_pairwise\_data($p,n$)\\
+ \texttt{// Allocate space for final array, and save pointer in $A$}\\
+ $A\leftarrow$ allocate($8n$)\\
+ \Return $p$ and $n$
+
+ \caption{Quicksort}
+\end{algorithm}
\begin{figure}[H]
- \snippet{19}{46}{../src/array_maker.s}
- \caption{Code snippet from \texttt{array\_maker.s}}\label{fig:arraysnippet}
+ \caption{Psudocode of \texttt{array\_maker.s}}\label{fig:arraysnippet}
\end{figure}
Load file in memory