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.

alignBackwardAnyAlign

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

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

File

lib/std/mem.zig:4881

Code

pub fn alignBackwardAnyAlign(comptime T: type, addr: T, alignment: T) T {
    if (isValidAlignGeneric(T, alignment))
        return alignBackward(T, addr, alignment);
    assert(alignment != 0);
    return addr - @mod(addr, alignment);
}