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
//! Float guards for the per-primitive recording path, each one compare.
//!
//! On armv7 every float compare moves the FPSCR flags to the core with
//! `vmrs`, which stalls a Cortex-A53's pipeline. `f32::max`, `f32::clamp`
//! and `f32::is_finite` add a NaN or absolute-value test to each call, so a
//! watch recording thousands of arcs a frame spent a tenth of its main
//! thread in them. These return the same values for the operands the
//! recorder passes.
/// `value.max(floor)` for a `floor` that is not NaN: a NaN `value` gives
/// `floor`, as `f32::max` does.
pub
/// `value.clamp(low, high)` for bounds that are not NaN with
/// `low <= high`: a NaN `value` stays NaN, as `f32::clamp` keeps it.
pub
/// Whether every value is finite, in one compare: a NaN or an infinity
/// times zero is NaN, and a sum holding a NaN is never zero.
pub