[#CeilDiv]
= CeilDiv
:mrdocs:

Integer ceiling division (for unsigned values)&period;

== Synopsis

Declared in `&lt;util&sol;overflow&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    std::unsigned&lowbar;integral Dividend,
    std::unsigned&lowbar;integral Divisor&gt;
&lsqb;&lsqb;nodiscard&rsqb;&rsqb;
constexpr
auto
CeilDiv(
    Dividend const dividend,
    Divisor const divisor);
----

== Description

Computes the smallest integer q such that q &ast; divisor &gt;&equals; dividend&period; Both dividend and divisor must be unsigned, and divisor must be non&hyphen;zero&period;

The implementation avoids overflow that can occur with `(dividend &plus; divisor &hyphen; 1) &sol; divisor`&period;

== Return Value

The smallest integer q such that `q &ast; divisor &gt;&equals; dividend`&period;

[NOTE]
====
The return value https://en.cppreference.com/cpp/language/attributes/nodiscard[should not be discarded^].
====
== Parameters

[cols="1,4"]
|===
| Name| Description
| *dividend*
| The value being divided&period;
| *divisor*
| The value to divide by, which must be non&hyphen;zero&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
