mirror of
https://gitee.com/openharmony/third_party_nghttp2
synced 2024-11-23 16:00:07 +00:00
Update huffman codes
This commit is contained in:
parent
b1722cbe28
commit
e5b0303481
File diff suppressed because it is too large
Load Diff
10
mkhufftbl.py
10
mkhufftbl.py
@ -120,18 +120,18 @@ tables = {}
|
||||
root = Node()
|
||||
|
||||
for line in sys.stdin:
|
||||
m = re.match(r'.*\(\s*(\d+)\) ([|01]+) \[(\d+)\]\s+(\S+).*', line)
|
||||
m = re.match(r'.*\(\s*(\d+)\)\s+([|01]+)\s+(\S+)\s+\[\s*(\d+)\].*', line)
|
||||
if m:
|
||||
#print m.group(1), m.group(2), m.group(3)
|
||||
if len(m.group(4)) > 8:
|
||||
#print m.group(1), m.group(2), m.group(4)
|
||||
if len(m.group(3)) > 8:
|
||||
raise Error('Code is more than 4 bytes long')
|
||||
sym = int(m.group(1))
|
||||
bits = re.sub(r'\|', '', m.group(2))
|
||||
nbits = int(m.group(3))
|
||||
nbits = int(m.group(4))
|
||||
assert(len(bits) == nbits)
|
||||
binpat = to_bin(bits)
|
||||
assert(len(binpat) == (nbits+7)/8)
|
||||
symbol_tbl[sym] = (binpat, nbits, m.group(4))
|
||||
symbol_tbl[sym] = (binpat, nbits, m.group(3))
|
||||
#print "Inserting", sym
|
||||
insert(root, sym, bits)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user