mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
22 lines
663 B
Java
22 lines
663 B
Java
class Main {
|
|
BitString test(long result, long mask) {
|
|
BitString intersection = new <caret>BitString(result, mask).intersect(super.getBitwiseMask());
|
|
assert intersection != null;
|
|
return intersection;
|
|
}
|
|
}
|
|
|
|
class BitString {
|
|
final long myBits;
|
|
final long myMask;
|
|
|
|
BitString(long bits, long mask) {
|
|
myBits = bits & mask;
|
|
myMask = mask;
|
|
}
|
|
BitString intersect(BitString other) {
|
|
long intersectMask = myMask & other.myMask;
|
|
if ((myBits & intersectMask) != (other.myBits & intersectMask)) return null;
|
|
return new BitString(myBits | other.myBits, myMask | other.myMask);
|
|
}
|
|
} |