Exercise solutions: the return type should be on the line above the function na… | |
git clone git://git.suckless.org/libzahl | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit faaa7dc980a80895b703775d18132eb6db105021 | |
parent 86eab9c9bc9a75e57b4e97792cd4227d069d6819 | |
Author: Mattias Andrée <[email protected]> | |
Date: Mon, 25 Jul 2016 17:08:51 +0200 | |
Exercise solutions: the return type should be on the line above the function na… | |
Signed-off-by: Mattias Andrée <[email protected]> | |
Diffstat: | |
M doc/exercises.tex | 12 ++++++++---- | |
1 file changed, 8 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/doc/exercises.tex b/doc/exercises.tex | |
@@ -336,7 +336,8 @@ $2^p \equiv 2 ~(\text{Mod}~p)$. This gives us | |
\vspace{-1em} | |
\begin{alltt} | |
-enum zprimality ptest_fast(z_t p) | |
+enum zprimality | |
+ptest_fast(z_t p) | |
\{ | |
z_t a; | |
int c = zcmpu(p, 2); | |
@@ -363,7 +364,8 @@ such that $1 < a < p$) if $t < 0$. | |
\vspace{-1em} | |
\begin{alltt} | |
-enum zprimality ptest_fermat(z_t witness, z_t p, int t) | |
+enum zprimality | |
+ptest_fermat(z_t witness, z_t p, int t) | |
\{ | |
enum zprimality rc = PROBABLY_PRIME; | |
z_t a, p1, p3, temp; | |
@@ -405,7 +407,8 @@ enum zprimality ptest_fermat(z_t witness, z_t p, int t) | |
\vspace{-1em} | |
\begin{alltt} | |
-enum zprimality ptest_llt(z_t n) | |
+enum zprimality | |
+ptest_llt(z_t n) | |
\{ | |
z_t s, M; | |
int c; | |
@@ -505,7 +508,8 @@ but for efficiency and briefness, we will use | |
\vspace{-1em} | |
\begin{alltt} | |
-void golden_pow(z_t r, z_t n) | |
+void | |
+golden_pow(z_t r, z_t n) | |
\{ | |
if (zsignum(n) <= 0) | |
zsetu(r, zcmpi(n, -1) >= 0); |