(x uint16)
| 288 | } |
| 289 | |
| 290 | func (ac *arrayContainer) iaddReturnMinimized(x uint16) container { |
| 291 | // Special case adding to the end of the container. |
| 292 | l := len(ac.content) |
| 293 | if l > 0 && l < arrayDefaultMaxSize && ac.content[l-1] < x { |
| 294 | ac.content = append(ac.content, x) |
| 295 | return ac |
| 296 | } |
| 297 | |
| 298 | loc := binarySearch(ac.content, x) |
| 299 | |
| 300 | if loc < 0 { |
| 301 | if len(ac.content) >= arrayDefaultMaxSize { |
| 302 | a := ac.toBitmapContainer() |
| 303 | a.iadd(x) |
| 304 | return a |
| 305 | } |
| 306 | s := ac.content |
| 307 | i := -loc - 1 |
| 308 | s = append(s, 0) |
| 309 | copy(s[i+1:], s[i:]) |
| 310 | s[i] = x |
| 311 | ac.content = s |
| 312 | } |
| 313 | return ac |
| 314 | } |
| 315 | |
| 316 | // iremoveReturnMinimized is allowed to change the return type to minimize storage. |
| 317 | func (ac *arrayContainer) iremoveReturnMinimized(x uint16) container { |
nothing calls this directly
no test coverage detected