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 › divCeil Public Function divCeil Doc Source Public Function std.math.big.int.Managed.divCeil
pub fn divCeil (q : *Managed , r : *Managed , a : *const Managed , b : *const Managed ) !void Params File math/big/int.zig: 3378
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390 pub fn divCeil (q : *Managed , r : *Managed , a : *const Managed , b : *const Managed ) !void {
const q_alias = limbsAliasDistinct (q , a ) or limbsAliasDistinct (q , b );
const r_alias = limbsAliasDistinct (r , a ) or limbsAliasDistinct (r , b );
try q .ensureAliasAwareCapacity (a .len (), q_alias );
try r .ensureAliasAwareCapacity (b .len (), r_alias );
var mq = q .toMutable ();
var mr = r .toMutable ();
const limbs_buffer = try q .allocator .alloc (Limb , calcDivLimbsBufferLen (a .len (), b .len ()));
defer q .allocator .free (limbs_buffer );
mq .divCeil (&mr , a .toConst (), b .toConst (), limbs_buffer );
q .setMetadata (mq .positive , mq .len );
r .setMetadata (mr .positive , mr .len );
}
q = a / b (rem r)
a / b are ceiled (rounded towards positive infinity).
Returns an error if memory could not be allocated.