Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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 standard library. Public Function

addScalar

Public Function
std.math.big.int.Managed.addScalar
pub fn addScalar(r: *Managed, a: *const Managed, scalar: anytype) Allocator.Error!void

r = a + scalar

r and a may be aliases.

Returns an error if memory could not be allocated.

Params

File

math/big/int.zig:3139
3139
3140
3141
3142
3143
3144
3145
3146
    pub fn addScalar(r: *Managed, a: *const Managed, scalar: anytype) Allocator.Error!void {
        const needed = @max(a.len(), calcLimbLen(scalar)) + 1;
        const aliased = limbsAliasDistinct(r, a);
        try r.ensureAliasAwareCapacity(needed, aliased);
        var m = r.toMutable();
        m.addScalar(a.toConst(), scalar);
        r.setMetadata(m.positive, m.len);
    }