summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-05-06 22:54:03 +0000
committerjbj <devnull@localhost>2003-05-06 22:54:03 +0000
commit5f26a13065d64ede572b33f00349af041309e74a (patch)
treef2007d5c4b2e5df73ff06b6ced744e959907daa8 /python
parent19306b30aa76c22277607a59a2ba6a9ff5eaf7ac (diff)
downloadlibrpm-tizen-5f26a13065d64ede572b33f00349af041309e74a.tar.gz
librpm-tizen-5f26a13065d64ede572b33f00349af041309e74a.tar.bz2
librpm-tizen-5f26a13065d64ede572b33f00349af041309e74a.zip
*** empty log message ***
CVS patchset: 6821 CVS date: 2003/05/06 22:54:03
Diffstat (limited to 'python')
-rw-r--r--python/mpw/test/test_methods.py13
-rw-r--r--python/rpmmpw-py.c7
2 files changed, 14 insertions, 6 deletions
diff --git a/python/mpw/test/test_methods.py b/python/mpw/test/test_methods.py
index 43c930c9a..e9fdb4637 100644
--- a/python/mpw/test/test_methods.py
+++ b/python/mpw/test/test_methods.py
@@ -47,6 +47,13 @@ class BasicTestCase(unittest.TestCase):
zb = mpz.mpz(0x0000000000000010)
zc = mpz.mpz(0x0fedcba000000000)
+ print "__hex__:\t", hex(wa), "\t", hex(za)
+ print "__oct__:\t", oct(wa), "\t", oct(za)
+
+ print "__int__:\t", mpw.__int__(wb), "\t", mpz.MPZType.__int__(zb)
+ print "__long__:\t", mpw.__long__(wb), "\t", mpz.MPZType.__long__(zb)
+ print "__float__:\t", mpw.__float__(wb), "\t", mpz.MPZType.__float__(zb)
+
print "__neg__:\t", hex(mpw.__neg__(wa)), "\t", hex(mpz.MPZType.__neg__(za))
print "__pos__:\t", hex(mpw.__pos__(wa)), "\t", hex(mpz.MPZType.__pos__(za))
print "__abs__:\t", hex(mpw.__abs__(wa)), "\t", hex(mpz.MPZType.__abs__(za))
@@ -61,7 +68,8 @@ class BasicTestCase(unittest.TestCase):
zq, zr = mpz.MPZType.__divmod__(za, zb)
print "__divmod__ q:\t", hex(wq), "\t", hex(zq)
print "__divmod__ r:\t", hex(wr), "\t", hex(zr)
- print "__pow__:\t", hex(mpw.__pow__(mpw(16), wb)), "\t", hex(mpz.MPZType.__pow__(mpz.mpz(16), zb))
+
+ print "__pow__:\t", hex(mpw.__pow__(wb, wb)), "\t", hex(mpz.MPZType.__pow__(zb, zb))
print "__lshift__:\t", hex(mpw.__lshift__(wa, wb)), "\t", hex(mpz.MPZType.__lshift__(za, zb))
print "__rshift__:\t", hex(mpw.__rshift__(wa, wb)), "\t", hex(mpz.MPZType.__rshift__(za, zb))
@@ -69,9 +77,6 @@ class BasicTestCase(unittest.TestCase):
print "__xor__:\t", hex(mpw.__xor__(wa, wa)), "\t", hex(mpz.MPZType.__xor__(za, za))
print "__or__:\t", hex(mpw.__or__(wa, wc)), "\t", hex(mpz.MPZType.__or__(za, zc))
-# print mpw.__int__(b)
-# print mpw.__long__(b)
-# print mpw.__float__(a)
# print mpw.__complex__(b)
# print mpw.__oct__(a*b)
# print mpw.__hex__(a*b)
diff --git a/python/rpmmpw-py.c b/python/rpmmpw-py.c
index de7898867..8a149d7f8 100644
--- a/python/rpmmpw-py.c
+++ b/python/rpmmpw-py.c
@@ -1181,8 +1181,11 @@ fprintf(stderr, " b %p[%d]:\t", m->n.data, m->n.size), mpfprintln(stderr, m->
}
break;
case 'P':
- mpnpow_w(&z->n, x->n.size, x->n.data, m->n.size, m->n.data);
- break;
+ { size_t bnorm = m->n.size - (mpbitcnt(m->n.size, m->n.data) + 31)/32;
+ size_t bsize = m->n.size - bnorm;
+ mpw* bdata = m->n.data + bnorm;
+ mpnpow_w(&z->n, x->n.size, x->n.data, bsize, bdata);
+ } break;
case 'G':
wksp = alloca((x->n.size) * sizeof(*wksp));
mpnsize(&z->n, m->n.size);