#pragma once #include namespace num { template ::value>::type* = nullptr> T iceil(T x, T y) { // this may seem inefficient, but on x86_64, when you already perform // division (x / y) the remainder is already computed and therefore x % y // is basically free! return x / y + (x % y != 0); } }