[pypy-commit] pypy default: try to clean up translation

fijal noreply at buildbot.pypy.org
Mon Mar 19 11:11:36 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: 
Changeset: r53800:9da831e4941c
Date: 2012-03-19 11:51 +0200
http://bitbucket.org/pypy/pypy/changeset/9da831e4941c/

Log:	try to clean up translation

diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -64,6 +64,8 @@
     return dispatcher
 
 class BaseType(object):
+    _attrs_ = ()
+    
     def _unimplemented_ufunc(self, *args):
         raise NotImplementedError
 
diff --git a/pypy/rlib/rarithmetic.py b/pypy/rlib/rarithmetic.py
--- a/pypy/rlib/rarithmetic.py
+++ b/pypy/rlib/rarithmetic.py
@@ -586,15 +586,18 @@
         a, b = arg & 0xFF, arg & 0xFF00
         res = (a << 8) | (b >> 8)
     elif rffi.sizeof(T) == 4:
-        a, b, c, d = arg & 0xFF, arg & 0xFF00, arg & 0xFF0000, arg & r_uint(0xFF000000)
+        FF = r_uint(0xFF)
+        arg = r_uint(arg)
+        a, b, c, d = (arg & FF, arg & (FF << 8), arg & (FF << 16),
+                      arg & (FF << 24))
         res = (a << 24) | (b << 8) | (c >> 8) | (d >> 24)
     elif rffi.sizeof(T) == 8:
-        a, b, c, d = (arg & 0xFF, arg & 0xFF00, arg & 0xFF0000,
-                      arg & r_uint(0xFF000000))
-        e, f, g, h = (arg & (r_ulonglong(0xFF) << 32),
-                      arg & (r_ulonglong(0xFF) << 40),
-                      arg & (r_ulonglong(0xFF) << 48),
-                      arg & (r_ulonglong(0xFF) << 56))
+        FF = r_ulonglong(0xFF)
+        arg = r_ulonglong(arg)
+        a, b, c, d = (arg & FF, arg & (FF << 8), arg & (FF << 16),
+                      arg & (FF << 24))
+        e, f, g, h = (arg & (FF << 32), arg & (FF << 40), arg & (FF << 48),
+                      arg & (FF << 56))
         res = ((a << 56) | (b << 40) | (c << 24) | (d << 8) | (e >> 8) |
                (f >> 24) | (g >> 40) | (h >> 56))
     else:


More information about the pypy-commit mailing list