Objets/Documentation
plages25.py
Comparer les préfixes par plage de longueurs · plages25.py
Télécharger ↓"""Exact byte intervals and actual streams around the first and last sign changes."""
from hashlib import sha256
from itertools import groupby
from math import comb
import json
from global21 import pack,unrank
from gamma23 import decode as gamma
from longueur22 import header,decode as aligned
def count(n,p):
body=1+(16*n+13*((n+63)//64) if p else 32*n)
return (body+2*n.bit_length()-1+7)//8,(body+7)//8+len(header(n))
def wire(n,p):
weights=[4 if p else (16,15)[j%2] for j in range(n)]
ranks=[(17+7919*j)%comb(32,w) for j,w in enumerate(weights)]