Commit 110964ac authored by Marcel van Lohuizen's avatar Marcel van Lohuizen

exp/norm: fixes a subtle bug introduced by change 10087: random offset

for map iteration.  New code makes table output predictable and fixes
bug.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5573044
parent 77cb8956
This diff is collapsed.
......@@ -65,11 +65,13 @@ func (n trieNode) mostFrequentStride() int {
counts[stride]++
}
v = t.value
} else {
v = 0
}
}
var maxs, maxc int
for stride, cnt := range counts {
if cnt > maxc {
if cnt > maxc || (cnt == maxc && stride < maxs) {
maxs, maxc = stride, cnt
}
}
......
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