Attention |
Topic was automatically imported from the old Question2Answer platform. | |

Asked By |
KonjacWyx |

```
func bit_and(x:Bitset) -> Bitset:
var ret = Bitset.new(max(bits, x.bits))
for i in range(min(bitmasks.size(), x.bitmasks.size())):
ret.bitmasks[i] = bitmasks[i] & x.bitmasks[i]
return ret
func bit_or(x:Bitset) -> Bitset:
var ret = Bitset.new(max(bits, x.bits))
for i in range(min(bitmasks.size(), x.bitmasks.size())):
ret.bitmasks[i] = bitmasks[i] | x.bitmasks[i]
return ret
func bit_xor(x:Bitset) -> Bitset:
var ret = Bitset.new(max(bits, x.bits))
for i in range(min(bitmasks.size(), x.bitmasks.size())):
ret.bitmasks[i] = bitmasks[i] ^ x.bitmasks[i]
return ret
func setminus(x:Bitset) -> void:
for i in range(bitmasks.size()):
bitmasks[i] = bitmasks[i] ^ (bitmasks[i] & x.bitmasks[i])
```

Here’s the code I used. But obviously I am now facing the problem of cyclic reference. How can I solve this problem and realize the functions I want.