upgrade .SerializeInstructionSequences() to the crazy checkpointing scheme.
This commit is contained in:
12
utils.go
12
utils.go
@@ -20,7 +20,7 @@ type Buffer struct {
|
||||
buf []byte
|
||||
}
|
||||
|
||||
func NewBuffer(buf []byte) Buffer {
|
||||
func newBuffer(buf []byte) Buffer {
|
||||
zero := 0
|
||||
return Buffer{&zero, buf}
|
||||
}
|
||||
@@ -99,3 +99,13 @@ func appendVarBytes(buf []byte, value []byte) []byte {
|
||||
buf = append(buf, value...)
|
||||
return buf
|
||||
}
|
||||
|
||||
func getCommonPrefixIndex(s1 []Instruction, s2 []Instruction) int {
|
||||
n := min(len(s1), len(s2))
|
||||
for i := 0; i < n; i++ {
|
||||
if CompareInstructions(s1[i], s2[i]) != 0 {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user