Function goldschmidt

Source
fn goldschmidt<F, I>(r_u0: I, s_u2: I, count: u32, final_set: bool) -> (I, I)
where F: SqrtHelper, I: HInt + From<u8>,
Expand description

Perform count goldschmidt iterations, returning (r_u0, s_u?).

  • r_u0 is the reciprocal r ~ 1 / sqrt(m), as U0.
  • s_u2 is the square root, s ~ sqrt(m), as U2.
  • count is the number of iterations to perform.
  • final_set should be true if this is the last round (same-sized integer). If so, the returned s will be U3, for later shifting. Otherwise, the returned s is U2.

Note that performance relies on the optimizer being able to unroll these loops (reasonably trivial, count is a constant when called).