Atelier des rouesLab FR
Objects/Documentation

poids27.py

Prefix cost at weight five · poids27.py

Download ↓
"""Prefix byte excess for weight-five 32-bit words, including real decoding."""
import json
from math import comb
from global21 import pack,unrank
from gamma23 import decode as gamma
from longueur22 import header,decode as aligned

WIDTH=(comb(32,5)-1).bit_length()
def sizes(n):
    blocks=(n+63)//64;body=1+13*blocks+WIDTH*n;l=n.bit_length()
    pad=(-body)%8
    formula=(2*l-1-pad+7)//8-(l+6)//7
    g=(body+2*l-1+7)//8;a=(body+7)//8+len(header(n))
    assert g-a==formula
    return g,a,pad

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.