summaryrefslogtreecommitdiff
path: root/gmpxx.h
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2008-02-27 14:55:32 +0100
committertege <tege@gmplib.org>2008-02-27 14:55:32 +0100
commita3faeddb3de4ff2f48be3bac605ac09438e81f30 (patch)
tree692a8fcf2c86171aba658ba624429239670d902f /gmpxx.h
parentfad91a51447a15642cfa80dfbfc7db500b46b3de (diff)
downloadgmp-a3faeddb3de4ff2f48be3bac605ac09438e81f30.tar.gz
(__gmp_binary_and, __gmp_binary_ior, __gmp_binary_xor):
Add variants with unsigned long int argument.
Diffstat (limited to 'gmpxx.h')
-rw-r--r--gmpxx.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/gmpxx.h b/gmpxx.h
index 76a726785..b9ec6bf8a 100644
--- a/gmpxx.h
+++ b/gmpxx.h
@@ -659,18 +659,72 @@ struct __gmp_binary_and
{
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_and(z, w, v); }
+ static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int i)
+ {
+ mpz_t temp;
+ mp_limb_t limbs[2];
+ temp->_mp_d = limbs;
+ temp->_mp_alloc = 2;
+ mpz_set_ui (temp, i);
+ mpz_and (z, w, temp);
+ }
+ static void eval(mpz_ptr z, unsigned long int i, mpz_srcptr w)
+ {
+ mpz_t temp;
+ mp_limb_t limbs[2];
+ temp->_mp_d = limbs;
+ temp->_mp_alloc = 2;
+ mpz_set_ui (temp, i);
+ mpz_and (z, temp, w);
+ }
};
struct __gmp_binary_ior
{
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_ior(z, w, v); }
+ static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int i)
+ {
+ mpz_t temp;
+ mp_limb_t limbs[2];
+ temp->_mp_d = limbs;
+ temp->_mp_alloc = 2;
+ mpz_set_ui (temp, i);
+ mpz_ior (z, w, temp);
+ }
+ static void eval(mpz_ptr z, unsigned long int i, mpz_srcptr w)
+ {
+ mpz_t temp;
+ mp_limb_t limbs[2];
+ temp->_mp_d = limbs;
+ temp->_mp_alloc = 2;
+ mpz_set_ui (temp, i);
+ mpz_ior (z, temp, w);
+ }
};
struct __gmp_binary_xor
{
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_xor(z, w, v); }
+ static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int i)
+ {
+ mpz_t temp;
+ mp_limb_t limbs[2];
+ temp->_mp_d = limbs;
+ temp->_mp_alloc = 2;
+ mpz_set_ui (temp, i);
+ mpz_xor (z, w, temp);
+ }
+ static void eval(mpz_ptr z, unsigned long int i, mpz_srcptr w)
+ {
+ mpz_t temp;
+ mp_limb_t limbs[2];
+ temp->_mp_d = limbs;
+ temp->_mp_alloc = 2;
+ mpz_set_ui (temp, i);
+ mpz_xor (z, temp, w);
+ }
};
struct __gmp_binary_lshift