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 18:13:53-04:00
log7af6ed3f20bbf0459ce6aed833c7e170ee6c927b
tree137f54dc601c61c1c7e749ace3b372cf76d0b9d4
parent3010668390794ad095eb9c102c079487c28efac6

add alignment docs


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

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