1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#![allow(dead_code)]
pub(crate) static SFNT_VERSIONS: [[u8; 4]; 4] = [
[0x00, 0x01, 0x00, 0x00],
[b'O', b'T', b'T', b'O'],
[b't', b'r', b'u', b'e'],
[b't', b'y', b'p', b'1'],
];
pub(crate) fn clamp(x: f32, min: f32, max: f32) -> f32 {
if x < min {
min
} else if x > max {
max
} else {
x
}
}
#[inline]
pub(crate) fn lerp(a: f32, b: f32, t: f32) -> f32 {
a + (b - a) * t
}
#[inline]
pub(crate) fn div_round_up(a: usize, b: usize) -> usize {
(a + b - 1) / b
}