in reply to popped bit in right shift operation
More generally, to get the stuff that goes away when you bitshift right by N bits, do a bitwise AND with 2^N-1.for my $num (64, 65) { my $popped = $num & 1; my $left = $num >> 1; print "$left leftover, $popped was popped\n"; } __OUTPUT__ 32 leftover, 0 was popped 32 leftover, 1 was popped
blokhead
|
|---|