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 › subSat Public Function subSat Doc Source Public Function std.math.big.int.Managed.subSat
pub fn subSat (
r : *Managed ,
a : *const Managed ,
b : *const Managed ,
signedness : Signedness ,
bit_count : usize ,
) Allocator .Error !void Params File math/big/int.zig: 3237
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250 pub fn subSat (
r : *Managed ,
a : *const Managed ,
b : *const Managed ,
signedness : Signedness ,
bit_count : usize ,
) Allocator .Error !void {
const aliased = limbsAliasDistinct (r , a ) or limbsAliasDistinct (r , b );
const needed = calcTwosCompLimbCount (bit_count );
try r .ensureAliasAwareCapacity (needed , aliased );
var m = r .toMutable ();
m .subSat (a .toConst (), b .toConst (), signedness , bit_count );
r .setMetadata (m .positive , m .len );
}
r = a - b with 2s-complement saturating semantics.
r, a and b may be aliases.
Returns an error if memory could not be allocated.