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.

centeredToPositive

Convert coefficient from centered representation to non-negative. Transforms value from [0,γ₁] ∪ (Q-γ₁, Q) to [0, 2γ₁).

ml_dsa.centeredToPositive
fn centeredToPositive(val: u32, comptime gamma1: u32) u32

File

lib/std/crypto/ml_dsa.zig:1126

Code

fn centeredToPositive(val: u32, comptime gamma1: u32) u32 {
    var result = gamma1 -% val;
    result +%= (signMask(u32, result) & Q);
    return result;
}