teki_common/utils/
math.rs1use vector2d::Vector2D;
2
3pub const ONE_BIT: i32 = 8;
4pub const ONE: i32 = 1 << ONE_BIT;
5
6pub fn round_vec(v: &Vector2D<i32>) -> Vector2D<i32> {
7 Vector2D::new(round_up_i32(v.x), round_up_i32(v.y))
8}
9
10pub const fn round_up_i32(v: i32) -> i32 {
11 (v + ONE / 2) >> ONE_BIT
12}