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 › subWrap Public Function subWrap Doc Source Public Function std.math.big.int.Managed.subWrap
pub fn subWrap (
r : *Managed ,
a : *const Managed ,
b : *const Managed ,
signedness : Signedness ,
bit_count : usize ,
) Allocator .Error !bool Params File math/big/int.zig: 3216
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230 pub fn subWrap (
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 .subWrap (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.