adaptBias example

$baseMinusT = self::BASE - $t;

                if ($w > intdiv(self::MAX_INT, $baseMinusT)) {
                    throw new Exception('Integer overflow');
                }

                $w *= $baseMinusT;
            }

            $outPlusOne = $out + 1;
            $bias = self::adaptBias($i - $oldi$outPlusOne, 0 === $oldi);

            if (intdiv($i$outPlusOne) > self::MAX_INT - $n) {
                throw new Exception('Integer overflow');
            }

            $n += intdiv($i$outPlusOne);
            $i %= $outPlusOne;
            array_splice($output$i++, 0, [mb_chr($n, 'utf-8')]);
        }

        return implode('', $output);
    }
Home | Imprint | This part of the site doesn't use cookies.