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 › debug_allocator › DebugAllocator › remap Private Function remap Doc Source Private Function std.heap.debug_allocator.DebugAllocator.remap
fn remap (
context : *anyopaque ,
memory : []u8 ,
alignment : mem .Alignment ,
new_len : usize ,
return_address : usize ,
) ?[*]u8 Params context : *anyopaque memory : []u8 alignment : mem .Alignment new_len : usize return_address : usize File heap/debug_allocator.zig: 845
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862 fn remap (
context : *anyopaque ,
memory : []u8 ,
alignment : mem .Alignment ,
new_len : usize ,
return_address : usize ,
) ?[*]u8 {
const self : *Self = @ptrCast (@alignCast (context ));
if (have_mutex ) std .Io .Threaded .mutexLock (&self .mutex );
defer if (have_mutex ) std .Io .Threaded .mutexUnlock (&self .mutex );
const size_class_index : usize = @max (@bitSizeOf (usize ) - @clz (memory .len - 1 ), @backingInt (alignment ));
if (size_class_index >= self .buckets .len ) {
return self .resizeLarge (memory , alignment , new_len , return_address , true );
} else {
return if (resizeSmall (self , memory , alignment , new_len , return_address , size_class_index )) memory .ptr else null ;
}
}