Add safe round-up integer division
This commit is contained in:
parent
45b3369bc9
commit
d2a20d7882
1 changed files with 6 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue