Change-Id: I9943a4f931c251a69bc8244c0d7723a0a3552073
GitHub-Last-Rev:
d9dd94ae4444cb0106756cdb98c1c5fa12fa5f79
GitHub-Pull-Request: golang/go#43622
Reviewed-on: https://go-review.googlesource.com/c/go/+/282992
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
package ssa
+import (
+ "math/bits"
+)
+
// Code to compute lowest common ancestors in the dominator tree.
// https://en.wikipedia.org/wiki/Lowest_common_ancestor
// https://en.wikipedia.org/wiki/Range_minimum_query#Solution_using_constant_time_and_linearithmic_space
}
// Compute fast range-minimum query data structure
- var rangeMin [][]ID
+ rangeMin := make([][]ID, 0, bits.Len64(uint64(len(tour))))
rangeMin = append(rangeMin, tour) // 1-size windows are just the tour itself.
for logS, s := 1, 2; s < len(tour); logS, s = logS+1, s*2 {
r := make([]ID, len(tour)-s+1)