(sa roaringArray, stoppingKey uint16)
| 180 | } |
| 181 | |
| 182 | func (ra *roaringArray) appendCopiesUntil(sa roaringArray, stoppingKey uint16) { |
| 183 | // cow only if the two request it, or if we already have a lightweight copy |
| 184 | copyonwrite := ra.copyOnWrite && sa.copyOnWrite |
| 185 | |
| 186 | for i := 0; i < sa.size(); i++ { |
| 187 | if sa.keys[i] >= stoppingKey { |
| 188 | break |
| 189 | } |
| 190 | thiscopyonewrite := copyonwrite || sa.needsCopyOnWrite(i) |
| 191 | if thiscopyonewrite { |
| 192 | ra.appendContainer(sa.keys[i], sa.containers[i], thiscopyonewrite) |
| 193 | if !sa.needsCopyOnWrite(i) { |
| 194 | sa.setNeedsCopyOnWrite(i) |
| 195 | } |
| 196 | |
| 197 | } else { |
| 198 | // since there is no copy-on-write, we need to clone the container (this is important) |
| 199 | ra.appendContainer(sa.keys[i], sa.containers[i].clone(), thiscopyonewrite) |
| 200 | } |
| 201 | } |
| 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 |
no test coverage detected