builtin: minor optimization of array.push() and array.push_noscan() (#13904)
parent
340543dfc0
commit
8c55a9ecd3
|
@ -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++
|
||||
}
|
||||
|
||||
|
|
|
@ -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++
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue