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.

cmovznzU64

The function cmovznzU64 is a single-word conditional move.

Postconditions: out1 = (if arg1 = 0 then arg2 else arg3)

Input Bounds: arg1: [0x0 ~> 0x1] arg2: [0x0 ~> 0xffffffffffffffff] arg3: [0x0 ~> 0xffffffffffffffff] Output Bounds: out1: [0x0 ~> 0xffffffffffffffff]

secp256k1_scalar_64.cmovznzU64
fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void

File

lib/std/crypto/pcurves/secp256k1/secp256k1_scalar_64.zig:100

Code

fn cmovznzU64(out1: *u64, arg1: u1, arg2: u64, arg3: u64) void {
    @setRuntimeSafety(mode == .debug);

    const mask = 0 -% @as(u64, arg1);
    out1.* = (mask & arg3) | ((~mask) & arg2);
}