Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r67931:31ea0b839ffc
Date: 2013-11-10 16:06 +0100
http://bitbucket.org/pypy/pypy/changeset/31ea0b839ffc/

Log:    Unmarshal longs using the new from_list_n_bits().

diff --git a/pypy/objspace/std/marshal_impl.py 
b/pypy/objspace/std/marshal_impl.py
--- a/pypy/objspace/std/marshal_impl.py
+++ b/pypy/objspace/std/marshal_impl.py
@@ -230,11 +230,8 @@
         lng = -lng
     else:
         negative = False
-    SHIFT = 15
-    result = rbigint.fromint(0)
-    for i in range(lng):
-        shift = i * SHIFT
-        result = result.or_(rbigint.fromint(u.get_short()).lshift(shift))
+    digits = [u.get_short() for i in range(lng)]
+    result = rbigint.from_list_n_bits(digits, 15)
     if lng and not result.tobool():
         raise_exception(space, 'bad marshal data')
     if negative:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to