pub fn normalize_classic_q12_scheduled(
input: Vec3I32,
) -> ClassicNormalizedVectorExpand description
Scale a Q12 direction to length 4096 with a 192-entry reciprocal square root table, the classic fixed-point way.
Each component is floored to whole units (>> 12) and kept as 16 bits.
With s the sum of their squares (wrapping i32):
L= leading zero bits ofs, rounded down to even.sshifted byL - 24lands in 64..=255; the table givesr= floor(4096 * sqrt(64 / that)).- Each component becomes
(c * r) >> ((31 - L) / 2).
Because L is even, the table entry equals 4096 * 2^(15 - L/2) / sqrt(s),
and the shift in step 3 removes that power of two exactly, leaving
4096 * c / sqrt(s) up to the table’s truncation. A zero or wrapped (negative)
s gives a zero vector. Pure integer work: no GTE state is used.