XP is just a number | |
PerlMonks |
Re^2: Displaying bit-vectors with Most Significant Bits to the left?by ikegami (Patriarch) |
on Jan 05, 2020 at 14:21 UTC ( [id://11110978]=note: print w/replies, xml ) | Need Help?? |
The OP didn't give any indication that $m0 was different than expected. Changing the value of $m0 doesn't seem appropriate. But if it is, there are two improvements you can make. When doing bit arithmetic, most people prefer to use actual bit arithmetic instead of powers. Not only is it more intuitive to use operations that match one's mental model, your approach fails if a bit is already set. Replace
with
As evidenced by these posts, vec is quite weird, so it's surely best to avoid it if it doesn't offer a benefit.
can be replaced with
In Section
Seekers of Perl Wisdom
|
|