diff --git a/src/math.rs b/src/math.rs new file mode 100644 index 0000000..a3901b3 --- /dev/null +++ b/src/math.rs @@ -0,0 +1,7 @@ +pub fn div_up(v: usize, divisor: usize) -> usize { + v / divisor + (v % divisor != 0) as usize +} + +pub fn div_down(v: usize, divisor: usize) -> usize { + v / divisor +}