$setbits = unpack "%32b*", $selectmask;
should be:
$setbits = unpack "%32b*", $packedmask;
so:
$setbits = unpack('%32b*', pack('N', $selectmask));
does the trick
print(unpack("%32b*", pack('N', 0x00500011)), $/); # 4
In reply to Re^3: how to pack bits, flags and masks
by ikegami
in thread how to pack bits, flags and masks
by anadem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |