MCPcopy Index your code
hub / github.com/google/codesearch / enc

Method enc

regexp/match.go:60–80  ·  view source on GitHub ↗

enc encodes z as a string.

()

Source from the content-addressed store, hash-verified

58
59// enc encodes z as a string.
60func (z *nstate) enc() string {
61 var buf []byte
62 var v [10]byte
63 last := ^uint32(0)
64 n := binary.PutUvarint(v[:], uint64(z.partial))
65 buf = append(buf, v[:n]...)
66 n = binary.PutUvarint(v[:], uint64(z.flag))
67 buf = append(buf, v[:n]...)
68 dense := z.q.Dense()
69 ids := make([]int, 0, len(dense))
70 for _, id := range z.q.Dense() {
71 ids = append(ids, int(id))
72 }
73 sort.Ints(ids)
74 for _, id := range ids {
75 n := binary.PutUvarint(v[:], uint64(uint32(id)-last))
76 buf = append(buf, v[:n]...)
77 last = uint32(id)
78 }
79 return string(buf)
80}
81
82// dec decodes the encoding s into z.
83func (z *nstate) dec(s string) {

Callers 3

initFunction · 0.95
TestNstateEncFunction · 0.95
cacheMethod · 0.80

Calls 1

DenseMethod · 0.80

Tested by 1

TestNstateEncFunction · 0.76