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 library itself.

alignForwardAnyAlign

Round an address down to the next (or current) aligned address. Unlike alignForward, alignment can be any positive number, not just a power of 2.

mem.alignForwardAnyAlign
pub fn alignForwardAnyAlign(comptime T: type, addr: T, alignment: T) T

File

lib/std/mem.zig:4753

Code

pub fn alignForwardAnyAlign(comptime T: type, addr: T, alignment: T) T {
    if (isValidAlignGeneric(T, alignment))
        return alignForward(T, addr, alignment);
    assert(alignment != 0);
    return alignBackwardAnyAlign(T, addr + (alignment - 1), alignment);
}