Atelier des rouesLab FR
Objects/Documentation

residus26.py

The byte cost of a prefix · residus26.py

Download ↓
"""Reach the weight-four byte decision using only a block residue and length bit count."""
from math import ceil
from plages25 import count
from pathlib import Path
import json

def delta(block_residue,length_bits):
    pad=(-1-5*block_residue)%8
    return (2*length_bits-1-pad+7)//8-(length_bits+6)//7

def study():
    old=json.loads(Path(__file__).with_name('plages25.json').read_bytes())[1]
    table=[[delta(k,b) for k in range(8)] for b in range(1,18)]
    checked=0
    for a,b,sgn in old['intervals']:
        for n in range(a,b+1):

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.