(wrong string) ée

From: <git_AT_suckless.org>
Date: Wed, 27 Apr 2016 14:41:22 +0200 (CEST)

commit 659a5a81045af899310dca5f70907da287c56d19
Author: Mattias Andrée <maandree_AT_kth.se>
AuthorDate: Wed Apr 27 14:35:13 2016 +0200
Commit: Mattias Andrée <maandree_AT_kth.se>
CommitDate: Wed Apr 27 14:35:13 2016 +0200

    Optimise zpowu and zmodpowu
    
    Signed-off-by: Mattias Andrée <maandree_AT_kth.se>

diff --git a/src/zmodpowu.c b/src/zmodpowu.c
index c9c8af5..fd5e925 100644
--- a/src/zmodpowu.c
+++ b/src/zmodpowu.c
_AT_@ -27,9 +27,11 @@ zmodpowu(z_t a, z_t b, unsigned long long int c, z_t d)
         zset(td, d);
         zsetu(a, 1);
 
- for (; c; c >>= 1) {
+ if (c & 1)
+ zmodmul(a, a, tb, td);
+ while (c >>= 1) {
+ zmodsqr(tb, tb, td);
                 if (c & 1)
                         zmodmul(a, a, tb, td);
- zmodsqr(tb, tb, td);
         }
 }
diff --git a/src/zpowu.c b/src/zpowu.c
index 9618010..3d58aa4 100644
--- a/src/zpowu.c
+++ b/src/zpowu.c
_AT_@ -23,10 +23,12 @@ zpowu(z_t a, z_t b, unsigned long long int c)
         zabs(tb, b);
         zsetu(a, 1);
 
- for (; c; c >>= 1) {
+ if (c & 1)
+ zmul_impl(a, a, tb);
+ while (c >>= 1) {
+ zsqr_impl(tb, tb);
                 if (c & 1)
                         zmul_impl(a, a, tb);
- zsqr_impl(tb, tb);
         }
 
         if (neg)
Received on Wed Apr 27 2016 - 14:41:22 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 27 2016 - 14:48:22 CEST