MCPcopy Create free account
hub / github.com/LFYSec/MScan / set

Method set

src/main/java/pascal/taie/util/collection/SparseBitSet.java:177–199  ·  view source on GitHub ↗
(int bitIndex)

Source from the content-addressed store, hash-verified

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) {

Callers 1

ofMethod · 0.95

Calls 7

resizeMethod · 0.95
wordIndexMethod · 0.95
level1IndexMethod · 0.95
level2IndexMethod · 0.95
getOrCreateBlockMethod · 0.95
level3IndexMethod · 0.95
invalidateStateMethod · 0.95

Tested by 1

ofMethod · 0.76