set adds the integers in vals to the set. Vals must be sorted in increasing order; if not, you should set alreadySorted to false, and we will sort them in place for you. (Be aware of this side effect -- it will affect the callers view of vals). If you have a small number of additions to an already
(alreadySorted bool, vals ...uint16)
| 289 | // If you have a small number of additions to an already |
| 290 | // big runContainer16, calling Add() may be faster. |
| 291 | func (rc *runContainer16) set(alreadySorted bool, vals ...uint16) { |
| 292 | rc2 := newRunContainer16FromVals(alreadySorted, vals...) |
| 293 | un := rc.union(rc2) |
| 294 | rc.iv = un.iv |
| 295 | } |
| 296 | |
| 297 | // canMerge returns true iff the intervals |
| 298 | // a and b either overlap or they are |