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.

memcmp

compiler_rt.memcmp
fn memcmp(vl: [*]const u8, vr: [*]const u8, n: usize) callconv(.c) c_int

File

lib/compiler_rt.zig:325

Code

fn memcmp(vl: [*]const u8, vr: [*]const u8, n: usize) callconv(.c) c_int {
    var i: usize = 0;
    while (i < n) : (i += 1) {
        const compared = @as(c_int, vl[i]) -% @as(c_int, vr[i]);
        if (compared != 0) return compared;
    }
    return 0;
}