Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Private Function

resize

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);
            }
        }