SortIndexInto sorts s and populates the index and hashes slice.
(keys []*Constant, index []int)
| 1454 | |
| 1455 | // SortIndexInto sorts s and populates the index and hashes slice. |
| 1456 | func SortIndexInto(keys []*Constant, index []int) { |
| 1457 | hashes := make([]uint64, len(keys)) |
| 1458 | for i := 0; i < len(keys); i++ { |
| 1459 | index[i] = i |
| 1460 | hashes[i] = keys[i].Hash() |
| 1461 | } |
| 1462 | sort.Stable(&keysorter{keys, hashes, index}) |
| 1463 | } |
| 1464 | |
| 1465 | // Helper to sort []*Constant by it's Hash(). |
| 1466 | type keysorter struct { |