MCPcopy Create free account
hub / github.com/ReadyTalk/avian / nextBit

Method nextBit

classpath/java/util/BitSet.java:181–206  ·  view source on GitHub ↗
(int fromIndex, boolean bitClear)

Source from the content-addressed store, hash-verified

179 }
180
181 private int nextBit(int fromIndex, boolean bitClear) {
182 int pos = longPosition(fromIndex);
183 if (pos >= bits.length) {
184 return -1;
185 }
186 int current = fromIndex;
187 do {
188 long currValue = bits[pos];
189 if (currValue == 0) {
190 pos++;
191 current = pos << BITS_PER_LONG_SHIFT;
192 } else {
193 do {
194 long bitPos = bitPosition(current);
195 if (((currValue & bitPos) != 0) ^ bitClear) {
196 return current;
197 } else {
198 current++;
199 }
200 } while (current % BITS_PER_LONG != 0);
201 }
202 pos++;
203 } while (pos < bits.length);
204
205 return -1;
206 }
207
208 public int nextClearBit(int fromIndex) {
209 return nextBit(fromIndex, true);

Callers 2

nextSetBitMethod · 0.95
nextClearBitMethod · 0.95

Calls 2

longPositionMethod · 0.95
bitPositionMethod · 0.95

Tested by

no test coverage detected