1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: minor optimization of array.push() and array.push_noscan() (#13904)

This commit is contained in:
yuyi 2022-04-03 16:04:18 +08:00 committed by GitHub
parent 340543dfc0
commit 8c55a9ecd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -587,7 +587,7 @@ fn (mut a array) push(val voidptr) {
if a.len >= a.cap {
a.ensure_cap(a.len + 1)
}
unsafe { vmemmove(&byte(a.data) + a.element_size * a.len, val, a.element_size) }
unsafe { vmemcpy(&byte(a.data) + a.element_size * a.len, val, a.element_size) }
a.len++
}

View File

@ -213,7 +213,7 @@ fn (a &array) clone_to_depth_noscan(depth int) array {
fn (mut a array) push_noscan(val voidptr) {
a.ensure_cap_noscan(a.len + 1)
unsafe { vmemmove(&byte(a.data) + a.element_size * a.len, val, a.element_size) }
unsafe { vmemcpy(&byte(a.data) + a.element_size * a.len, val, a.element_size) }
a.len++
}