hex.copy_bytes¶
Copies “count[:w/4]” bytes from the src-pointed buffer to the dst-pointed buffer.
dst_ptr,src_ptr,count are hex[:w/4]. All three are preserved.
@Assumes: the buffers do not overlap.
Signature¶
def copy_bytes dst_ptr, src_ptr, count @ loop, finish, wptr, rptr, cnt, bytebuf, end { ... }
Defined in hex/strings.fj — lines 111–129 (view on GitHub).
Complexity¶
Time:
count(w(1.75@+10) + 45@+80)Space:
w(4.5@+90) + 55@+450
See the complexity glossary for what @, w, dw, dbit, n mean.
Requires init¶
The following must be initialised before this macro is invoked:
hex.init and stl.ptr_init (or stl.startup_and_init_all).
Source¶
Click to view the macro body
def copy_bytes dst_ptr, src_ptr, count @ loop, finish, wptr, rptr, cnt, bytebuf, end {
.mov w/4, wptr, dst_ptr
.mov w/4, rptr, src_ptr
.mov w/4, cnt, count
loop:
.if0 w/4, cnt, finish
.read_byte_and_inc bytebuf, rptr
.write_byte_and_inc wptr, bytebuf
.dec w/4, cnt
;loop
finish:
;end
wptr: .vec w/4
rptr: .vec w/4
cnt: .vec w/4
bytebuf: .vec 2
end:
}
Depends on¶
← Previous: hex.fill_bytes