aboutsummaryrefslogtreecommitdiffstats
path: root/bench
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-13 05:30:01 +0100
committerMattias Andrée <maandree@kth.se>2016-03-13 05:30:01 +0100
commitf6cb7f3e7382a19a6d6d9990c243ffb8a666182d (patch)
treedbf43f976f66a39fd87ffa38d59194b425efaa68 /bench
parentMake zabs, zneg and zswap inline (diff)
downloadlibzahl-f6cb7f3e7382a19a6d6d9990c243ffb8a666182d.tar.gz
libzahl-f6cb7f3e7382a19a6d6d9990c243ffb8a666182d.tar.bz2
libzahl-f6cb7f3e7382a19a6d6d9990c243ffb8a666182d.tar.xz
Optimisations
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'bench')
-rw-r--r--bench/libgmp.h14
-rw-r--r--bench/libtommath.h2
2 files changed, 13 insertions, 3 deletions
diff --git a/bench/libgmp.h b/bench/libgmp.h
index 832bfe9..7dc74e2 100644
--- a/bench/libgmp.h
+++ b/bench/libgmp.h
@@ -40,7 +40,7 @@ zunsetup(void)
#define QUASIUNIFORM 0
#define UNIFORM 1
-#define zperror(x) 0
+#define zperror(x) ((void)0)
#define zinit mpz_init
#define zfree mpz_clear
@@ -54,7 +54,6 @@ zunsetup(void)
#define zand mpz_and
#define zor mpz_ior
#define zxor mpz_xor
-#define znot mpz_com
#define zbtest mpz_tstbit
#define zeven mpz_even_p /* Note, must not have side effects. */
#define zodd mpz_odd_p /* Note, must not have side effects. */
@@ -118,6 +117,17 @@ zseti(z_t r, long long int val)
}
static void
+znot(z_t r, z_t a)
+{
+ size_t bits = zbits(a);
+ mpz_set_ui(_b, 0);
+ mpz_setbit(_b, bits);
+ zsub(_b, _b, _1);
+ zxor(r, a, _b);
+ zneg(r, r);
+}
+
+static void
zsplit(z_t high, z_t low, z_t a, size_t brk)
{
if (low == a) {
diff --git a/bench/libtommath.h b/bench/libtommath.h
index c321c78..4a81373 100644
--- a/bench/libtommath.h
+++ b/bench/libtommath.h
@@ -33,7 +33,7 @@ zunsetup(void)
#define QUASIUNIFORM 0
#define UNIFORM 1
-#define zperror(x) 0
+#define zperror(x) ((void)0)
#define zinit(a) mp_init(a)
#define zfree(a) mp_clear(a)