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

sqrNoAlias

Public Function
std.math.big.int.Mutable.sqrNoAlias
pub fn sqrNoAlias(rma: *Mutable, a: Const, opt_allocator: ?Allocator) void

rma = a * a

rma may not alias with a.

Asserts the result fits in rma. An upper bound on the number of limbs needed by rma is given by 2 * a.limbs.len + 1.

If allocator is provided, it will be used for temporary storage to improve multiplication performance. error.OutOfMemory is handled with a fallback algorithm.

Params

File

math/big/int.zig:1085
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
    pub fn sqrNoAlias(rma: *Mutable, a: Const, opt_allocator: ?Allocator) void {
        _ = opt_allocator;
        assert(rma.limbs.ptr != a.limbs.ptr); // illegal aliasing

        @memset(rma.limbs, 0);

        llsquareBasecase(rma.limbs, a.limbs);

        rma.normalize(2 * a.limbs.len + 1);
        rma.positive = true;
    }