aboutsummaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorDamian Tarnawski <gthetarnav@gmail.com>2025-08-23 13:10:19 +0200
committerDamian Tarnawski <gthetarnav@gmail.com>2025-08-23 13:10:19 +0200
commit9d651348b5c6772db26af79dd2ff077c3af670f2 (patch)
treeffc5de45ad471be7b994572994cf9633a79ea3df /base
parent05706864b7cdbd8fabf09dd8cb4d55e1e9174acf (diff)
Only zero memory when requested
Diffstat (limited to 'base')
-rw-r--r--base/runtime/core_builtin_soa.odin18
1 files changed, 9 insertions, 9 deletions
diff --git a/base/runtime/core_builtin_soa.odin b/base/runtime/core_builtin_soa.odin
index 5baeb9e24..7548f6735 100644
--- a/base/runtime/core_builtin_soa.odin
+++ b/base/runtime/core_builtin_soa.odin
@@ -262,10 +262,9 @@ _reserve_soa :: proc(array: ^$T/#soa[dynamic]$E, capacity: int, zero_memory: boo
footer.cap = capacity
- // Adjust layout
- // before: |x x y y z z|
- // now: |x x y y z z _ _ _|
- // after: |x x _ y y _ z z _|
+ // Correct data memory
+ // from: |x x y y z z _ _ _|
+ // to: |x x _ y y _ z z _|
for i in 0..<field_count {
type := si.types[i].variant.(Type_Info_Multi_Pointer).elem
@@ -280,7 +279,9 @@ _reserve_soa :: proc(array: ^$T/#soa[dynamic]$E, capacity: int, zero_memory: boo
(^rawptr)(uintptr(array) + i*size_of(rawptr))^ = new_data_elem
- mem_zero(old_data_elem, int(uintptr(new_data_elem) - uintptr(old_data_elem)))
+ if zero_memory {
+ mem_zero(old_data_elem, int(uintptr(new_data_elem) - uintptr(old_data_elem)))
+ }
old_offset += type.size * old_cap
new_offset += type.size * capacity
@@ -301,10 +302,9 @@ _reserve_soa :: proc(array: ^$T/#soa[dynamic]$E, capacity: int, zero_memory: boo
footer.cap = capacity
- // Adjust layout
- // before: |x x y y z z|
- // now: |x x y y z z| ... |_ _ _ _ _ _ _ _ _|
- // after: |x x _ y y _ z z _|
+ // Correct data memory
+ // from: |x x y y z z| ... |_ _ _ _ _ _ _ _ _|
+ // to: |x x _ y y _ z z _|
for i in 0..<field_count {
type := si.types[i].variant.(Type_Info_Multi_Pointer).elem