Aerys\HPack::huffman_codes_init PHP Method

huffman_codes_init() private static method

private static huffman_codes_init ( )
    private static function huffman_codes_init()
    {
        $lookup = [];
        for ($chr = 0; $chr <= 0xff; $chr++) {
            $bits = self::HUFFMAN_CODE[$chr];
            $len = self::HUFFMAN_CODE_LENGTHS[$chr];
            for ($bit = 0; $bit < 8; $bit++) {
                $bytes = floor(($len + $bit - 1) / 8);
                for ($byte = $bytes; $byte >= 0; $byte--) {
                    $lookup[$bit][chr($chr)][] = chr($byte ? $bits >> $len - ($bytes - $byte + 1) * 8 + $bit : $bits << (0x30 - $len - $bit) % 8);
                }
            }
        }
        return $lookup;
    }