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.

__addvdi3

addvdi3.__addvdi3
pub fn __addvdi3(a: i64, b: i64) callconv(.c) i64

File

lib/compiler_rt/addvdi3.zig:8

Code

pub fn __addvdi3(a: i64, b: i64) callconv(.c) i64 {
    const sum = a +% b;
    // Overflow occurred iff both operands have the same sign, and the sign of the sum does
    // not match it. In other words, iff the sum sign is not the sign of either operand.
    if (((sum ^ a) & (sum ^ b)) < 0) @panic("compiler-rt: integer overflow");
    return sum;
}