- or download this
use common::sense;
...
printf "union is %#032b %d\n", $u, $u;
say "set bit count in intersection: $i_cnt";
say "set bit count in union: $u_cnt";
- or download this
a is 0b000000000000000000000000000011 3
b is 0b000000000000000000000000000110 6
...
union is 0b000000000000000000000000000111 7
set bit count in intersection: 3
set bit count in union: 5
- or download this
a is 0b000000000000000000000000000011 3
b is 0b000000000000000000000000000110 6
...
union is 0b000000000000000000000000000111 7
set bit count in intersection: 1
set bit count in union: 3