Commit 4609aced authored by Nigel Tao's avatar Nigel Tao

go.net/publicsuffix: when generating table.go, track how much slack we

have in the bit-packing.

This was previously printed to stderr by gen.go, but is now written to
the generated table.go, so that we have better records of how it
changes over time.

LGTM=dr.volker.dobler
R=dr.volker.dobler
CC=golang-codereviews
https://golang.org/cl/89090043
parent c0ac5a09
......@@ -234,14 +234,6 @@ func main1() error {
return err
}
if *v {
fmt.Fprintf(os.Stderr, "max children %d (capacity %d)\n", maxChildren, 1<<nodesBitsChildren-1)
fmt.Fprintf(os.Stderr, "max text offset %d (capacity %d)\n", maxTextOffset, 1<<nodesBitsTextOffset-1)
fmt.Fprintf(os.Stderr, "max text length %d (capacity %d)\n", maxTextLength, 1<<nodesBitsTextLength-1)
fmt.Fprintf(os.Stderr, "max hi %d (capacity %d)\n", maxHi, 1<<childrenBitsHi-1)
fmt.Fprintf(os.Stderr, "max lo %d (capacity %d)\n", maxLo, 1<<childrenBitsLo-1)
}
b, err := format.Source(buf.Bytes())
if err != nil {
return err
......@@ -378,7 +370,12 @@ var children=[...]uint32{
fmt.Fprintf(w, "0x%08x, // c0x%04x (%s)%s %s\n",
c, i, s, wildcardStr(wildcard), nodeTypeStr(nodeType))
}
fmt.Fprintf(w, "}\n")
fmt.Fprintf(w, "}\n\n")
fmt.Fprintf(w, "// max children %d (capacity %d)\n", maxChildren, 1<<nodesBitsChildren-1)
fmt.Fprintf(w, "// max text offset %d (capacity %d)\n", maxTextOffset, 1<<nodesBitsTextOffset-1)
fmt.Fprintf(w, "// max text length %d (capacity %d)\n", maxTextLength, 1<<nodesBitsTextLength-1)
fmt.Fprintf(w, "// max hi %d (capacity %d)\n", maxHi, 1<<childrenBitsHi-1)
fmt.Fprintf(w, "// max lo %d (capacity %d)\n", maxLo, 1<<childrenBitsLo-1)
return nil
}
......
......@@ -7376,3 +7376,9 @@ var children = [...]uint32{
0x066d19a8, // c0x016e (n0x19a8-n0x19b4) +
0x066ed9b4, // c0x016f (n0x19b4-n0x19bb) +
}
// max children 367 (capacity 511)
// max text offset 23226 (capacity 32767)
// max text length 36 (capacity 63)
// max hi 6587 (capacity 16383)
// max lo 6580 (capacity 16383)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment