aboutsummaryrefslogtreecommitdiff
path: root/std/mem.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-04-22 12:52:28 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-04-22 12:52:28 -0400
commit98b88bb52f6385cb5dbbd6bc2238939d8f45e47e (patch)
treec354ddfc649bdbba830f3868ce8496fd6eeca5cc /std/mem.zig
parenta3e9ae8f74050d8a28553defc92e1a61b09f34c8 (diff)
downloadzig-98b88bb52f6385cb5dbbd6bc2238939d8f45e47e.tar.gz
zig-98b88bb52f6385cb5dbbd6bc2238939d8f45e47e.zip
add alignment docs
Diffstat (limited to 'std/mem.zig')
-rw-r--r--std/mem.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/std/mem.zig b/std/mem.zig
index 8a59d6251b..eb67ce83ef 100644
--- a/std/mem.zig
+++ b/std/mem.zig
@@ -11,6 +11,8 @@ pub const Allocator = struct {
/// Allocate byte_count bytes and return them in a slice, with the
/// slice's pointer aligned at least to alignment bytes.
/// The returned newly allocated memory is undefined.
+ /// `alignment` is guaranteed to be >= 1
+ /// `alignment` is guaranteed to be a power of 2
allocFn: fn (self: &Allocator, byte_count: usize, alignment: u29) Error![]u8,
/// If `new_byte_count > old_mem.len`:
@@ -22,6 +24,8 @@ pub const Allocator = struct {
/// * alignment <= alignment of old_mem.ptr
///
/// The returned newly allocated memory is undefined.
+ /// `alignment` is guaranteed to be >= 1
+ /// `alignment` is guaranteed to be a power of 2
reallocFn: fn (self: &Allocator, old_mem: []u8, new_byte_count: usize, alignment: u29) Error![]u8,
/// Guaranteed: `old_mem.len` is the same as what was returned from `allocFn` or `reallocFn`