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 standard library.
std › math › big › int › Managed › addWrap Public Function addWrap Doc Source Public Function std.math.big.int.Managed.addWrap
pub fn addWrap (
r : *Managed ,
a : *const Managed ,
b : *const Managed ,
signedness : Signedness ,
bit_count : usize ,
) Allocator .Error !bool Params File math/big/int.zig: 3167
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181 pub fn addWrap (
r : *Managed ,
a : *const Managed ,
b : *const Managed ,
signedness : Signedness ,
bit_count : usize ,
) Allocator .Error !bool {
const aliased = limbsAliasDistinct (r , a ) or limbsAliasDistinct (r , b );
const needed = calcTwosCompLimbCount (bit_count );
try r .ensureAliasAwareCapacity (needed , aliased );
var m = r .toMutable ();
const wrapped = m .addWrap (a .toConst (), b .toConst (), signedness , bit_count );
r .setMetadata (m .positive , m .len );
return wrapped ;
}
r = a + b with 2s-complement wrapping semantics. Returns whether any overflow occurred.
r, a and b may be aliases.
Returns an error if memory could not be allocated.