Author: Philip Jenvey <[email protected]>
Branch: remove-intlong-smm
Changeset: r68587:3b13a844ca2c
Date: 2014-01-06 14:51 -0800
http://bitbucket.org/pypy/pypy/changeset/3b13a844ca2c/
Log: cleanup
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -258,6 +258,7 @@
descr_add, descr_radd = _make_generic_descr_binop('add')
descr_sub, descr_rsub = _make_generic_descr_binop('sub')
descr_mul, descr_rmul = _make_generic_descr_binop('mul')
+
descr_and, descr_rand = _make_generic_descr_binop('and', ovf=False)
descr_or, descr_ror = _make_generic_descr_binop('or', ovf=False)
descr_xor, descr_rxor = _make_generic_descr_binop('xor', ovf=False)
diff --git a/pypy/objspace/std/smalllongobject.py
b/pypy/objspace/std/smalllongobject.py
--- a/pypy/objspace/std/smalllongobject.py
+++ b/pypy/objspace/std/smalllongobject.py
@@ -337,6 +337,13 @@
return W_SmallLongObject(res)
descr_and, descr_rand = _make_descr_binop(_and, ovf=False)
+ def _or(self, space, w_other):
+ a = self.longlong
+ b = w_other.longlong
+ res = a | b
+ return W_SmallLongObject(res)
+ descr_or, descr_ror = _make_descr_binop(_or, ovf=False)
+
def _xor(self, space, w_other):
a = self.longlong
b = w_other.longlong
@@ -344,15 +351,6 @@
return W_SmallLongObject(res)
descr_xor, descr_rxor = _make_descr_binop(_xor, ovf=False)
- def _or(self, space, w_other):
- a = self.longlong
- b = w_other.longlong
- res = a | b
- return W_SmallLongObject(res)
- descr_or, descr_ror = _make_descr_binop(_or, ovf=False)
-
-
-# ____________________________________________________________
def _llong_mul_ovf(a, b):
# xxx duplication of the logic from translator/c/src/int.h
@@ -378,21 +376,24 @@
return longprod
raise OverflowError("integer multiplication")
-# ____________________________________________________________
def delegate_SmallLong2Float(space, w_small):
return space.newfloat(float(w_small.longlong))
+
def delegate_SmallLong2Complex(space, w_small):
return space.newcomplex(float(w_small.longlong), 0.0)
+
def _int2small(space, w_int):
# XXX: W_IntObject.descr_long should probably return W_SmallLongs
return W_SmallLongObject(r_longlong(w_int.int_w(space)))
+
def _small2long(space, w_small):
return W_LongObject(w_small.asbigint())
+
def _pow_impl(space, iv, w_int2, iz):
iw = space.int_w(w_int2)
if iw < 0:
@@ -418,6 +419,7 @@
ix %= iz
return W_SmallLongObject(ix)
+
def add_ovr(space, w_int1, w_int2):
x = r_longlong(space.int_w(w_int1))
y = r_longlong(space.int_w(w_int2))
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit