mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
[mem]: Adjust the docs for calc_padding_with_header
This commit is contained in:
+1
-2
@@ -1019,8 +1019,7 @@ Default resize procedure.
|
|||||||
|
|
||||||
When allocator does not support resize operation, but supports
|
When allocator does not support resize operation, but supports
|
||||||
`.Alloc_Non_Zeroed` and `.Free`, this procedure is used to implement allocator's
|
`.Alloc_Non_Zeroed` and `.Free`, this procedure is used to implement allocator's
|
||||||
default behavior on
|
default behavior on resize.
|
||||||
resize.
|
|
||||||
|
|
||||||
Unlike `default_resize_align` no new memory is being explicitly
|
Unlike `default_resize_align` no new memory is being explicitly
|
||||||
zero-initialized.
|
zero-initialized.
|
||||||
|
|||||||
+19
-3
@@ -644,10 +644,26 @@ align_formula :: proc "contextless" (size, align: int) -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Calculate the padding after the pointer with a header.
|
Calculate the padding for header preceding aligned data.
|
||||||
|
|
||||||
This procedure returns the next address, following `ptr` and `header_size`
|
This procedure returns the padding, following the specified pointer `ptr` that
|
||||||
bytes of space that is aligned to a boundary specified by `align`.
|
will be able to fit in a header of the size `header_size`, immediately
|
||||||
|
preceding the memory region, aligned on a boundary specified by `align`. See
|
||||||
|
the following diagram for a visual representation.
|
||||||
|
|
||||||
|
header size
|
||||||
|
|<------>|
|
||||||
|
+---+--------+------------- - - -
|
||||||
|
| HEADER | DATA...
|
||||||
|
+---+--------+------------- - - -
|
||||||
|
^ ^
|
||||||
|
|<---------->|
|
||||||
|
| padding |
|
||||||
|
ptr aligned ptr
|
||||||
|
|
||||||
|
The function takes in `ptr` and `header_size`, as well as the required
|
||||||
|
alignment for `DATA`. The return value of the function is the padding between
|
||||||
|
`ptr` and `aligned_ptr` that will be able to fit the header.
|
||||||
*/
|
*/
|
||||||
@(require_results)
|
@(require_results)
|
||||||
calc_padding_with_header :: proc "contextless" (ptr: uintptr, align: uintptr, header_size: int) -> int {
|
calc_padding_with_header :: proc "contextless" (ptr: uintptr, align: uintptr, header_size: int) -> int {
|
||||||
|
|||||||
Reference in New Issue
Block a user