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.

jrand48

drand48.jrand48
fn jrand48(xsubi: *[3]c_ushort) callconv(.c) c_long

File

lib/c/stdlib/drand48.zig:42

Code

fn jrand48(xsubi: *[3]c_ushort) callconv(.c) c_long {
    const xi = @as(u48, @as(u16, @truncate(xsubi[0])) | (@as(u48, @as(u16, @truncate(xsubi[1])))) << 16) | (@as(u48, @as(u16, @truncate(xsubi[2]))) << 32);

    var separate_lcg: Lcg = .init(xi, lcg.a, lcg.c);
    const next_xi = separate_lcg.next();

    xsubi.* = .{ @truncate(next_xi & 0xFFFF), @truncate((next_xi >> 16) & 0xFFFF), @truncate((next_xi >> 32) & 0xFFFF) };
    return @as(i32, @bitCast(@as(u32, @truncate(next_xi >> 16))));
}