code length:

                code = 0;
                bl_count[0] = 0;
                for (bits = 1; bits &lt;= MAX_BITS; bits++) {
                    code = (code + bl_count[bits-1]) &lt;&lt; 1;
                    next_code[bits] = code;
                }

         3)  Assign numerical values to all codes, using consecutive
             values for all codes of the same length with the base
             values determined at step 2. Codes that are never used
             (which have a bit length of zero