Commits

Lars Wassermann committed cb9c370

changed return type of unwrap positive 32 bit int from int to r_uint

Comments (0)

Files changed (3)

spyvm/interpreter_proxy.py

                 else:
                     return result
             except error.PrimitiveFailedError:
-                print '\t-> failed'
+                if IProxy.trace_proxy:
+                    print '\t-> failed'
                 IProxy.failed()
                 from rpython.rlib.objectmodel import we_are_translated
                 if not we_are_translated():
 
 @expose_on_virtual_machine_proxy([oop], int)
 def positive32BitValueOf(n):
-    return IProxy.space.unwrap_positive_32bit_int(n)
+    from rpython.rlib.rarithmetic import intmask
+    return intmask(IProxy.space.unwrap_positive_32bit_int(n))
 
 #     /* InterpreterProxy methodsFor: 'special objects' */
 

spyvm/objspace.py

     def unwrap_positive_32bit_int(self, w_value):
         if isinstance(w_value, model.W_SmallInteger):
             if w_value.value >= 0:
-                return w_value.value
+                return r_uint(w_value.value)
         elif isinstance(w_value, model.W_LargePositiveInteger1Word):
-            return w_value.value
+            return r_uint(w_value.value)
         raise UnwrappingError("Wrong types or negative SmallInteger.")
 
     def unwrap_char(self, w_char):

spyvm/primitives.py

         @expose_primitive(code, unwrap_spec=[pos_32bit_int, pos_32bit_int])
         def func(interp, s_frame, receiver, argument):
             res = op(receiver, argument)
-            return interp.space.wrap_positive_32bit_int(res)
+            return interp.space.wrap_positive_32bit_int(rarithmetic.intmask(res))
     make_func(op)
 
 # #/ -- return the result of a division, only succeed if the division is exact