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 › resize Private Function resize Doc Source Private Function std.heap.debug_allocator.DebugAllocator.resize
fn resize (
context : *anyopaque ,
memory : []u8 ,
alignment : mem .Alignment ,
new_len : usize ,
return_address : usize ,
) bool Params context : *anyopaque memory : []u8 alignment : mem .Alignment new_len : usize return_address : usize File heap/debug_allocator.zig: 826
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843 fn resize (
context : *anyopaque ,
memory : []u8 ,
alignment : mem .Alignment ,
new_len : usize ,
return_address : usize ,
) bool {
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 , false ) != null ;
} else {
return resizeSmall (self , memory , alignment , new_len , return_address , size_class_index );
}
}