mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
fn copy(dst, src) []byte
This commit is contained in:
parent
c7edeb00a8
commit
df06eee5e8
@ -251,3 +251,13 @@ pub fn (b []byte) hex() string {
|
|||||||
}
|
}
|
||||||
return string(hex)
|
return string(hex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: implement for all types
|
||||||
|
pub fn copy(dst, src []byte) int {
|
||||||
|
if dst.len > 0 && src.len > 0 {
|
||||||
|
min := if dst.len < src.len { dst.len } else { src.len }
|
||||||
|
C.memcpy(dst.data, src.left(min).data, dst.element_size*min)
|
||||||
|
return min
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user