瀏覽代碼

fix #3692 memory alignment bug in core:mem.dynamic_pool_alloc_bytes

DerTee 1 年之前
父節點
當前提交
6b373cf49e
共有 1 個文件被更改,包括 1 次插入3 次删除
  1. 1 3
      core/mem/allocators.odin

+ 1 - 3
core/mem/allocators.odin

@@ -748,9 +748,7 @@ dynamic_pool_alloc_bytes :: proc(p: ^Dynamic_Pool, bytes: int) -> ([]byte, Alloc
 		return
 	}
 
-	n := bytes
-	extra := p.alignment - (n % p.alignment)
-	n += extra
+	n := align_formula(bytes, p.alignment)
 	if n > p.block_size {
 		return nil, .Invalid_Argument
 	}