Lars Wassermann avatar 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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.