(long[] dir_, int slot, long v1, long v2)
| 130 | |
| 131 | |
| 132 | static final long[] dirPut(long[] dir_, int slot, long v1, long v2){ |
| 133 | int offset = dirOffsetFromSlot(dir_, slot); |
| 134 | //make copy and expand it if necessary |
| 135 | if (offset < 0) { |
| 136 | offset = -offset; |
| 137 | dir_ = Arrays.copyOf(dir_, dir_.length + 2); |
| 138 | //make space for new value |
| 139 | System.arraycopy(dir_, offset, dir_, offset + 2, dir_.length - 2 - offset); |
| 140 | //and update bitmap |
| 141 | int bytePos = slot / 64; |
| 142 | int bitPos = slot % 64; |
| 143 | dir_[bytePos] = (dir_[bytePos] | (1L << bitPos)); |
| 144 | } else { |
| 145 | dir_ = dir_.clone(); |
| 146 | } |
| 147 | //and insert value itself |
| 148 | dir_[offset] = v1; |
| 149 | dir_[offset+1] = v2; |
| 150 | return dir_; |
| 151 | } |
| 152 | |
| 153 | static final long[] dirRemove(long[] dir, final int slot){ |
| 154 | int offset = dirOffsetFromSlot(dir, slot); |
no test coverage detected