Atelier des rouesLab FR
Objects/Documentation

plages25.py

Comparing prefixes by length interval · plages25.py

Download ↓
"""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)]

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.