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

Method or

src/main/java/pascal/taie/util/collection/RegularBitSet.java:425–468  ·  view source on GitHub ↗
(IBitSet set)

Source from the content-addressed store, hash-verified

423 }
424
425 @Override
426 public boolean or(IBitSet set) {
427 if (this == set) {
428 return false;
429 }
430 if (!(set instanceof RegularBitSet other)) {
431 return super.or(set);
432 }
433
434 int wordsInCommon = Math.min(wordsInUse, other.wordsInUse);
435
436 boolean changed = false;
437 if (wordsInUse < other.wordsInUse) {
438 ensureCapacity(other.wordsInUse);
439 wordsInUse = other.wordsInUse;
440 changed = true;
441 }
442
443 // Perform logical OR on words in common
444 for (int i = 0; i < wordsInCommon; i++) {
445 if (changed) {
446 // already know set changed, just perform logical OR
447 words[i] |= other.words[i];
448 } else {
449 long oldWord = words[i];
450 long newWord = oldWord | other.words[i];
451 if (oldWord != newWord) {
452 words[i] = newWord;
453 changed = true;
454 }
455 }
456 }
457
458 // Copy any remaining words
459 if (wordsInCommon < other.wordsInUse) {
460 System.arraycopy(other.words, wordsInCommon,
461 words, wordsInCommon,
462 wordsInUse - wordsInCommon);
463 }
464
465 // recalculateWordsInUse() is unnecessary
466 checkInvariants();
467 return changed;
468 }
469
470 @Override
471 public IBitSet orDiff(IBitSet set) {

Callers

nothing calls this directly

Calls 5

ensureCapacityMethod · 0.95
checkInvariantsMethod · 0.95
arraycopyMethod · 0.80
orMethod · 0.65
minMethod · 0.45

Tested by

no test coverage detected