Atelier des rouesLab FR
Objects/Documentation

global21.py

I provide the code for this study. Pricing one stream-level choice bit

Download ↓
"""One stream mode bit. The decoder knows the word count, including in raw mode."""
from math import comb
import json
from segments20 import run,decode,unrank


def pack(bits):
    bits+='0'*(-len(bits)%8)
    return int(bits,2).to_bytes(len(bits)//8,'big')


def unpack(wire,count):
    bits=''.join(f'{b:08b}' for b in wire)
    body=bits[1:]
    if bits[0]=='0':
        if len(body)<32*count or len(body)-32*count>=8 or '1' in body[32*count:]:raise ValueError("raw length")

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.