Example #1
0
 def unpack_list_of_int_items(self, ptr, length):
     if self.size == rffi.sizeof(rffi.LONG):
         from rpython.rlib.rrawarray import populate_list_from_raw_array
         res = []
         buf = rffi.cast(rffi.LONGP, ptr)
         populate_list_from_raw_array(res, buf, length)
         return res
     elif self.value_smaller_than_long:
         res = [0] * length
         misc.unpack_list_from_raw_array(res, ptr, self.size)
         return res
     return None
Example #2
0
 def unpack_list_of_int_items(self, ptr, length):
     if self.size == rffi.sizeof(rffi.LONG):
         from rpython.rlib.rrawarray import populate_list_from_raw_array
         res = []
         buf = rffi.cast(rffi.LONGP, ptr)
         populate_list_from_raw_array(res, buf, length)
         return res
     elif self.value_smaller_than_long:
         res = [0] * length
         misc.unpack_list_from_raw_array(res, ptr, self.size)
         return res
     return None
Example #3
0
 def unpack_list_of_int_items(self, w_cdata):
     if self.size == rffi.sizeof(rffi.LONG):
         from rpython.rlib.rrawarray import populate_list_from_raw_array
         res = []
         buf = rffi.cast(rffi.LONGP, w_cdata._cdata)
         length = w_cdata.get_array_length()
         populate_list_from_raw_array(res, buf, length)
         return res
     elif self.value_smaller_than_long:
         res = [0] * w_cdata.get_array_length()
         misc.unpack_list_from_raw_array(res, w_cdata._cdata, self.size)
         return res
     return None
Example #4
0
    def unpack_list_of_int_items(self, w_cdata):
        if self.size == rffi.sizeof(rffi.LONG):
            from rpython.rlib.rrawarray import populate_list_from_raw_array

            res = []
            buf = rffi.cast(rffi.LONGP, w_cdata._cdata)
            length = w_cdata.get_array_length()
            populate_list_from_raw_array(res, buf, length)
            return res
        elif self.value_fits_long:
            res = [0] * w_cdata.get_array_length()
            misc.unpack_list_from_raw_array(res, w_cdata._cdata, self.size)
            return res
        return None
Example #5
0
 def unpack_list_of_int_items(self, w_cdata):
     if self.size == rffi.sizeof(rffi.LONG):
         from rpython.rlib.rrawarray import populate_list_from_raw_array
         res = []
         length = w_cdata.get_array_length()
         with w_cdata as ptr:
             buf = rffi.cast(rffi.LONGP, ptr)
             populate_list_from_raw_array(res, buf, length)
         return res
     elif self.value_smaller_than_long:
         res = [0] * w_cdata.get_array_length()
         with w_cdata as ptr:
             misc.unpack_list_from_raw_array(res, ptr, self.size)
         return res
     return None