aboutsummaryrefslogtreecommitdiffstats
path: root/bench/libgmp.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-04-27 13:30:47 +0200
committerMattias Andrée <maandree@kth.se>2016-04-27 13:30:47 +0200
commit8c2ad212d78184d59e4181993c195b35c4cde166 (patch)
treed4cc9d6a6808ce55102666c727eeb51f8870457e /bench/libgmp.h
parentFix const-correctness in libtommath translation and add error checking in hebimath translation (diff)
downloadlibzahl-8c2ad212d78184d59e4181993c195b35c4cde166.tar.gz
libzahl-8c2ad212d78184d59e4181993c195b35c4cde166.tar.bz2
libzahl-8c2ad212d78184d59e4181993c195b35c4cde166.tar.xz
Improve library translations
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--bench/libgmp.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/bench/libgmp.h b/bench/libgmp.h
index 14ccca4..2c22019 100644
--- a/bench/libgmp.h
+++ b/bench/libgmp.h
@@ -64,8 +64,6 @@ zunsetup(void)
#define zor mpz_ior
#define zxor mpz_xor
#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. */
#define zeven_nonzero zeven
#define zodd_nonzero zodd
#define zzero(a) (!mpz_sgn(a))
@@ -97,6 +95,18 @@ zunsetup(void)
#define zmod mpz_tdiv_r
#define zdivmod mpz_tdiv_qr
+static inline int
+zeven(z_t a)
+{
+ return mpz_even_p(a);
+}
+
+static inline int
+zodd(z_t a)
+{
+ return mpz_odd_p(a);
+}
+
static inline void
zsetu(z_t r, unsigned long long int val)
{