Atelier des rouesLab FR
Objects/Documentation

longueur22.py

Transmitting a stream length · longueur22.py

Download ↓
"""Byte-aligned self-delimiting length prefix, followed by the global21 payload."""
import json
from math import comb
from global21 import study as payload,unpack,unrank


def header(n):
    if n<1:raise ValueError('positive count required')
    out=bytearray()
    while n>=128:
        out.append(128+(n%128));n//=128
    return bytes(out)+bytes([n])


def decode(wire):
    n=0

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.