//! 2×2 transition matrix for Bernstein-Yang divstep inner loop.
//!
//! Each `DivstepMatrix` accumulates 62 divstep transitions into a compact
//! `i64` matrix `[[u, v], [q, r]]` that is then applied to the full-width
//! `(f, g)` and Bézout `(d, e)` pairs. Matrix elements stay bounded:
//! `|u|+|v| < 2^62` and `|q|+|r| < 2^62` after 62 steps.

/// A 2×2 transition matrix with `i64` entries accumulated over 62 divsteps.
///
/// Represents the transformation:
/// ```text
/// [f']   [u  v] [f]        [d']   [u  v] [d]
/// [g'] = [q  r] [g] / 2^n  [e'] = [q  r] [e] mod m
/// ```
/// where `n` is the number of accumulated steps (always 62 in practice).
pub(crate) struct DivstepMatrix {
    pub(crate) u: i64,
    pub(crate) v: i64,
    pub(crate) q: i64,
    pub(crate) r: i64,
}

mod new;
mod step;
mod apply_fg;
mod apply_de;
