| 175 | } |
| 176 | |
| 177 | @Override |
| 178 | public boolean set(int bitIndex) { |
| 179 | if ((bitIndex + 1) < 1) { |
| 180 | throw new IndexOutOfBoundsException("bitIndex=" + bitIndex); |
| 181 | } |
| 182 | if (bitIndex >= bitsLength) { |
| 183 | resize(bitIndex); |
| 184 | } |
| 185 | |
| 186 | final int w = wordIndex(bitIndex); |
| 187 | final int w1 = level1Index(w); |
| 188 | final int w2 = level2Index(w); |
| 189 | long[] a3 = getOrCreateBlock(w1, w2); |
| 190 | int w3 = level3Index(w); |
| 191 | long oldWord = a3[w3]; |
| 192 | long newWord = oldWord | (1L << bitIndex); |
| 193 | if (oldWord != newWord) { |
| 194 | a3[w3] = newWord; |
| 195 | invalidateState(); |
| 196 | return true; |
| 197 | } |
| 198 | return false; |
| 199 | } |
| 200 | |
| 201 | @Override |
| 202 | public boolean clear(int bitIndex) { |