aboutsummaryrefslogtreecommitdiffstats
path: root/src/zpowu.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-05-13 04:38:09 +0200
committerMattias Andrée <maandree@kth.se>2016-05-13 04:38:09 +0200
commit16a001c8fe4e5ca99d5aafdd8ed02a35f09b6caa (patch)
treefe1116e5d8ce39e032c777003caa6d03ce667c78 /src/zpowu.c
parentExponentiation: clarification of a mathematical expression (diff)
downloadlibzahl-16a001c8fe4e5ca99d5aafdd8ed02a35f09b6caa.tar.gz
libzahl-16a001c8fe4e5ca99d5aafdd8ed02a35f09b6caa.tar.bz2
libzahl-16a001c8fe4e5ca99d5aafdd8ed02a35f09b6caa.tar.xz
Miscellaneous stuff
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/zpowu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/zpowu.c b/src/zpowu.c
index 35247c3..5a7676d 100644
--- a/src/zpowu.c
+++ b/src/zpowu.c
@@ -21,10 +21,11 @@ zpowu(z_t a, z_t b, unsigned long long int c)
neg = znegative(b) && (c & 1);
zabs(tb, b);
- zsetu(a, 1);
if (c & 1)
- zmul_ll(a, a, tb);
+ zset(a, tb);
+ else
+ zsetu(a, 1);
while (c >>= 1) {
zsqr_ll(tb, tb);
if (c & 1)