Commit a9a56005 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0168ea57
......@@ -794,20 +794,10 @@ func diffT(ctx context.Context, A, B *Tree, δZTC SetOid, trackSet PPTreeSubSet)
a.done = true
}
/*
// continue with next right bucket until r coverage is complete
lo = a.hi_ + 1
if r.hi_ < lo {
break
}
*/
// XXX change vvv to ^^^
// stop if r coverage is complete
if r.hi_ <= a.hi_ {
break
}
// continue with next right bucket
lo = a.hi_ + 1
}
}
......
......@@ -605,6 +605,13 @@ func _KAdj_old(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
return kadj
}
const traceKAdj = true
func tracefKAdj(format string, argv ...interface{}) {
if traceKAdj {
fmt.Printf(format, argv...)
}
}
func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
var keys SetKey
switch len(keysv) {
......@@ -616,10 +623,10 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
panic("multiple key sets on the call")
}
//tracef("\n\n_KAdj\n")
//tracef("t1: %s\n", t1.tree)
//tracef("t2: %s\n", t2.tree)
//tracef("keys: %s\n", keys)
tracefKAdj("\n\n_KAdj\n")
tracefKAdj("t1: %s\n", t1.tree)
tracefKAdj("t2: %s\n", t2.tree)
tracefKAdj("keys: %s\n", keys)
// kadj = {} k -> adjacent keys.
// if k is tracked -> changes to adjacents must be in Update(t1->t2).
......@@ -633,15 +640,15 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
done1 := &RangedKeySet{}
done2 := &RangedKeySet{}
//tracef("\nk%d\n", k)
tracefKAdj("\nk%d\n", k)
for !q1.Empty() || !q2.Empty() {
//tracef("q1: %s\tdone1: %s\n", q1, done1)
//tracef("q2: %s\tdone2: %s\n", q2, done2)
tracefKAdj("q1: %s\tdone1: %s\n", q1, done1)
tracefKAdj("q2: %s\tdone2: %s\n", q2, done2)
for _, r1 := range q1.AllRanges() {
lo1 := r1.lo
for {
b1 := t1.xkv.Get(lo1)
//tracef(" b1: %s\n", b1)
tracefKAdj(" b1: %s\n", b1)
for k_ := range keys {
if b1.lo <= k_ && k_ <= b1.hi_ {
adj1.Add(k_)
......@@ -654,13 +661,13 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
δq2.AddRange(b1r)
δq2.DifferenceInplace(done2)
q2.UnionInplace(δq2)
//tracef("q2 += %s\t-> %s\n", δq2, q2)
tracefKAdj("q2 += %s\t-> %s\n", δq2, q2)
// continue with next right bucket until r1 coverage is complete
lo1 = b1.hi_ + 1
if r1.hi_ < lo1 {
if r1.hi_ <= b1.hi_ {
break
}
lo1 = b1.hi_ + 1
}
}
q1.Clear()
......@@ -669,7 +676,7 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
lo2 := r2.lo
for {
b2 := t2.xkv.Get(lo2)
//tracef(" b2: %s\n", b2)
tracefKAdj(" b2: %s\n", b2)
for k_ := range keys {
if b2.lo <= k_ && k_ <= b2.hi_ {
adj2.Add(k_)
......@@ -682,13 +689,13 @@ func _KAdj(t1, t2 *tTreeCommit, keysv ...SetKey) (kadj KAdjMatrix) {
δq1.AddRange(b2r)
δq1.DifferenceInplace(done1)
q1.UnionInplace(δq1)
//tracef("q1 += %s\t-> %s\n", δq1, q1)
tracefKAdj("q1 += %s\t-> %s\n", δq1, q1)
// continue with next right bucket until r2 coverage is complete
lo2 = b2.hi_ + 1
if r2.hi_ < lo2 {
if r2.hi_ <= b2.hi_ {
break
}
lo2 = b2.hi_ + 1
}
}
q2.Clear()
......
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