fn adapt(delta: u32, num_points: u32, first_time: bool) -> u32 {
    // delta is scaled in order to avoid overflow.
    let mut delta = if first_time {
        // When this is the very first delta, the divisor is not 2, but
        // instead a constant called damp.  This compensates for the fact
        // that the second delta is usually much smaller than the first.
        delta / DAMP
    } else {
        delta / 2
    };

    // Delta is increased to compensate for the fact that the next delta
    // will be inserting into a longer string.
    delta = delta + (delta / num_points);

    let mut k = 0;
    while delta > ((BASE - TMIN) * TMAX) / 2 {
        delta /= BASE - TMIN;
        k += BASE;
    }

    k + (((BASE - TMIN + 1) * delta) / (delta + SKEW))
}
// Bias adaptation
//
// num_points is the total number of code points encoded/decoded so
// far (including the one corresponding to this delta itself, and
// including the basic code points).
//
// Reference:
// * https://datatracker.ietf.org/doc/html/rfc3492#section-3.4
// * https://datatracker.ietf.org/doc/html/rfc3492#section-6.1
Bias adaptation
num_points is the total number of code points encoded/decoded so
far (including the one corresponding to this delta itself, and
including the basic code points).


Bias adaptation num_points is the total number of code points encoded / decoded so far ( including the one corresponding to this delta itself and including the basic code points ) .
fn adapt(delta: u32, num_points: u32, first_time: bool) -> u32 {
    // delta is scaled in order to avoid overflow.
    let mut delta = if first_time {
        // When this is the very first delta, the divisor is not 2, but
        // instead a constant called damp.  This compensates for the fact
        // that the second delta is usually much smaller than the first.
        delta / DAMP
    } else {
        delta / 2
    };
    // Delta is increased to compensate for the fact that the next delta
    // will be inserting into a longer string.
    delta = delta + (delta / num_points);
    let mut k = 0;
    while delta > ((BASE - TMIN) * TMAX) / 2 {
        delta /= BASE - TMIN;
        k += BASE;
    }
    k + (((BASE - TMIN + 1) * delta) / (delta + SKEW))
}
fn adapt ( delta : u32 , num_points : u32 , first_time : bool ) -> u32 { // delta is scaled in order to avoid overflow. let mut delta = if first_time { // When this is the very first delta, the divisor is not 2, but // instead a constant called damp.  This compensates for the fact // that the second delta is usually much smaller than the first. delta / DAMP } else { delta / 2 } ; // Delta is increased to compensate for the fact that the next delta // will be inserting into a longer string. delta = delta + ( delta / num_points ) ; let mut k = 0 ; while delta > ( ( BASE - TMIN ) * TMAX ) / 2 { delta /= BASE - TMIN ; k += BASE ; } k + ( ( ( BASE - TMIN + 1 ) * delta ) / ( delta + SKEW ) ) }
Bias adaptation
num_points is the total number of code points encoded/decoded so
far (including the one corresponding to this delta itself, and
including the basic code points).
Bias adaptation num_points is the total number of code points encoded / decoded so far ( including the one corresponding to this delta itself and including the basic code points ) .
delta
u32
num_points
u32
first_time
bool