Add safe round-up integer division

This commit is contained in:
Nikita Lisitsa 2022-02-11 14:26:11 +03:00
parent 45b3369bc9
commit d2a20d7882

View file

@ -165,4 +165,10 @@ namespace psemek::geom
return x - m * idiv(x, m);
}
template <typename T>
T div_ceil(T x, T y)
{
return (x / y) + ((x % y) == 0 ? 0 : 1);
}
}