authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-04-22 12:52:28-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-04-22 12:52:28-04:00
log98b88bb52f6385cb5dbbd6bc2238939d8f45e47e
treec354ddfc649bdbba830f3868ce8496fd6eeca5cc
parenta3e9ae8f74050d8a28553defc92e1a61b09f34c8

add alignment docs


1 files changed, 4 insertions(+), 0 deletions(-)

std/mem.zig+4
......@@ -11,6 +11,8 @@ pub const Allocator = struct {
1111 /// Allocate byte_count bytes and return them in a slice, with the
1212 /// slice's pointer aligned at least to alignment bytes.
1313 /// The returned newly allocated memory is undefined.
14 /// `alignment` is guaranteed to be >= 1
15 /// `alignment` is guaranteed to be a power of 2
1416 allocFn: fn (self: &Allocator, byte_count: usize, alignment: u29) Error![]u8,
1517
1618 /// If `new_byte_count > old_mem.len`:
......@@ -22,6 +24,8 @@ pub const Allocator = struct {
2224 /// * alignment <= alignment of old_mem.ptr
2325 ///
2426 /// The returned newly allocated memory is undefined.
27 /// `alignment` is guaranteed to be >= 1
28 /// `alignment` is guaranteed to be a power of 2
2529 reallocFn: fn (self: &Allocator, old_mem: []u8, new_byte_count: usize, alignment: u29) Error![]u8,
2630
2731 /// Guaranteed: `old_mem.len` is the same as what was returned from `allocFn` or `reallocFn`