(sa roaringArray, beforeStart uint16)
| 202 | } |
| 203 | |
| 204 | func (ra *roaringArray) appendCopiesAfter(sa roaringArray, beforeStart uint16) { |
| 205 | // cow only if the two request it, or if we already have a lightweight copy |
| 206 | copyonwrite := ra.copyOnWrite && sa.copyOnWrite |
| 207 | |
| 208 | startLocation := sa.getIndex(beforeStart) |
| 209 | if startLocation >= 0 { |
| 210 | startLocation++ |
| 211 | } else { |
| 212 | startLocation = -startLocation - 1 |
| 213 | } |
| 214 | |
| 215 | for i := startLocation; i < sa.size(); i++ { |
| 216 | thiscopyonewrite := copyonwrite || sa.needsCopyOnWrite(i) |
| 217 | if thiscopyonewrite { |
| 218 | ra.appendContainer(sa.keys[i], sa.containers[i], thiscopyonewrite) |
| 219 | if !sa.needsCopyOnWrite(i) { |
| 220 | sa.setNeedsCopyOnWrite(i) |
| 221 | } |
| 222 | } else { |
| 223 | // since there is no copy-on-write, we need to clone the container (this is important) |
| 224 | ra.appendContainer(sa.keys[i], sa.containers[i].clone(), thiscopyonewrite) |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | func (ra *roaringArray) removeIndexRange(begin, end int) { |
| 230 | if end <= begin { |
no test coverage detected