def _strncpy(dst, dst_offset, src, src_offset, n): if src._kind == dst._kind: byte_width = _kind_to_byte_width(src._kind) src_byte_offset = byte_width * src_offset dst_byte_offset = byte_width * dst_offset nbytes = n * byte_width memcpy_region(dst._data, dst_byte_offset, src._data, src_byte_offset, nbytes, align=1) else: for i in range(n): _set_code_point(dst, dst_offset + i, _get_code_point(src, src_offset + i))
def foo(dst, dst_index, src, src_index, nbytes): # last arg is assume 1 byte alignment memcpy_region(dst.ctypes.data, dst_index, src.ctypes.data, src_index, nbytes, 1)