Especially once this code gets copied into x/tools, we need a way to
evolve the file format, so add an explicit version number.
Change-Id: I9cc2e357c3ca3f07fd8d0c0ba4e4a95f89edeac6
Reviewed-on: https://go-review.googlesource.com/c/go/+/388914
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
r := strings.NewReader(input)
+ var version uint32
+ assert(binary.Read(r, binary.LittleEndian, &version) == nil)
+ assert(version == 0)
+
assert(binary.Read(r, binary.LittleEndian, pr.elemEndsEnds[:]) == nil)
pr.elemEnds = make([]uint32, pr.elemEndsEnds[len(pr.elemEndsEnds)-1])
assert(binary.Write(out, binary.LittleEndian, x) == nil)
}
+ writeUint32(0) // version
+
var sum uint32
for _, elems := range &pw.elems {
sum += uint32(len(elems))