Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › heap › SmpAllocator › remap Private Function remap Doc Source Private Function std.heap.SmpAllocator.remap
fn remap (context : *anyopaque , memory : []u8 , alignment : Alignment , new_len : usize , ra : usize ) ?[*]u8 Params context : *anyopaque memory : []u8 alignment : Alignment new_len : usize ra : usize File heap/SmpAllocator.zig: 188
188
189
190
191
192
193
194
195
196
197
198 fn remap (context : *anyopaque , memory : []u8 , alignment : Alignment , new_len : usize , ra : usize ) ?[*]u8 {
_ = context ;
_ = ra ;
const class = sizeClassIndex (memory .len , alignment );
const new_class = sizeClassIndex (new_len , alignment );
if (class >= size_class_count ) {
if (new_class < size_class_count ) return null ;
return PageAllocator .realloc (memory , alignment , new_len , true );
}
return if (new_class == class ) memory .ptr else null ;
}